eolymp
bolt
Try our new interface for solving problems
Problems

The Shortest does not Mean the S

The Shortest does not Mean the S

Your are given integer numbers \textbf{A}, \textbf{B} and \textbf{C}. Output the remainder of division \textbf{A^B} (\textbf{B}-th power of \textbf{A}) by \textbf{C}. \textbf{Input} The only line of the input file contains three integers: \textbf{A}, \textbf{B}, \textbf{C} (\textbf{1} <= \textbf{A}, \textbf{B}, \textbf{C} <= \textbf{10^18}). Numbers are separated by spaces. \textbf{Output} Output file must contain only one non-negative integer less than \textbf{C} - the answer to the problem.
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
3 4 5
Output example #1
1