getting wa

http://www.codechef.com/viewsolution/4845839

Instead of doing the modular operation in the end, try doing it at each step. If you don’t understand why we are doing this, then first of all, learn modular arithmetic :slight_smile:

Se my solution for instance: http://www.codechef.com/viewsolution/4708980

1 Like