Not Everything Short is Simple#252

Not Everything Short is Simple

2 seconds
64 megabytes
Medium

You are given three integers , , and . Output the remainder when A^B (the -th power of ) is divided by .

Input

The only line of the input file contains three integers: , , (1 \leq A, B, C \leq 10^{18}). The numbers are separated by spaces.

Output

The output file must contain one non-negative integer less than — the answer to the problem.

Examples

Example 1

Loading
Loading