atcoder#ARC113B. [ARC113B] A^B^C

[ARC113B] A^B^C

Score : 400400 points

Problem Statement

Given positive integers A,B,CA, B, C, find the digit at the ones place in the decimal notation of ABCA^{B^C}.

Constraints

  • 1A,B,C1091\leq A,B,C \leq 10^9
  • A,B,CA,B,C are integers.

Input

Input is given from Standard Input in the following format:

AA BB CC

Output

Print the digit at the one's place in the decimal notation of ABCA^{B^C}.

4 3 2
4

The ones digit in the decimal notation of 432=49=2621444^{3^2}=4^9=262144 is 44.

1 2 3
1
3141592 6535897 9323846
2