can't understand modulo

modulo

#1

Hey, can anybody help me with Que 6 of July Challenge2017. What does it mean P/Q modulo 10^9 + 7


#2

It means that if the answer is the fraction P/Q where gcd(P, Q) = 1. Then you have to output an integer, that is P/Q mod M where M = 10^9 + 7.

Now, P/Q mod M = (P mod M) ***** (Q^-1 mod M)

Here Q^-1 mod M is the Modular Multiplicative Inverse (MMI) of Q.

You can read about finding the MMI in the following link.

https://comeoncodeon.wordpress.com/2011/10/09/modular-multiplicative-inverse/