can't understand modulo

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

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.

1 Like