Give you a integer number N (1 ≤ n ≤ 2 ∗ 10^100). Please compute
S = 1^1 + 2^2 + 3^3 + . . . + N^N
Give the last digit of S to me.
Input
Input file consists of several N ’s, each N a line. It is ended with N = 0.
Output
For each N give a line containing only one digit, which is the last digit of S.