Hide

Problem B
Binary Exponentiation

Accepted submissions to this problem will be granted a score of 10
Languages en is

You are given non-negative integers a,e,m and should print ae(modm).

Input

The first and only line of input contains non-negative integers a,e,m1018 separated by a space. We also have m2.

Output

Print ae(modm).

Sample Input 1 Sample Output 1
15 7 99
27
Hide

Please log in to submit a solution to this problem

Log in