Problem B.Last Digit |

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 file consists of several Ns, each N a line. It is ended with N=0.

For each N give a line containing only one digit, which is the last digit of S.

1

2

3

0

1

5

2