Find the answer of (ABC)%M.
Input:
The only line of input consists of four integers A,B,C and M. The input always has C and M such that gcd(C,M)=1.
Output:
Print the answer as asked in the problem statement.
Constraints:
1≤A,B,C,M≤109
gcd(C,M)=1.
23=8
so, 8/4 = 2
Finally, 2%5 = 2