Problem1902--CF742 - A. Arpa’s hard exam and Mehrdad’s naive cheat

1902: CF742 - A. Arpa’s hard exam and Mehrdad’s naive cheat

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

There exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.
Mehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, givenn, print the last digit of $1378^n$.
 
Mehrdad has become quite confused and wants you to help him. Please help, although it's a naive cheat.

Input

The single line of input contains one integer $n\ (0≤n≤10^9)$.

Output

Print single integer− the last digit of $1378^n$.

Sample 1 Input

1

Sample 1 Output

8
last digit of $1378^1 = 1378$ is 8.

Sample 2 Input

2

Sample 2 Output

4
last digit of $1378^2 = 1378·1378 = 1898884$ is 4.

HINT

CF742

Source/Category