Find power of power under mod of a prime
Given four numbers A, B, C and M, where M is prime number. Our task is to find ABC (mod M).Example: Input : A = 2, B = 4, C = 3, M = 23 Output : 6 43 = 64 so, 2^64(mod 23) = 6 A Naive Approach is to calculate res = BC and then calculate Ares % M by modular exponential. The problem of this approach is that we can't apply directly mod M on BC, so we