Modular exponentiation


unable to pass all the test cases ?

This is not how modular exponentiation works. Please take a look at this link and read about it