2065.Arpa’s hard exam and Mehrdad’s naive cheat

Time Limit: 1s Memory Limit: 256MB

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, given n, print the last digit of 1378n.

2065_1.png

Mehrdad has become quite confused and wants you to help him. Please help, although it's a naive cheat.

Input Format(From the terminal/stdin)

The single line of input contains one integer n (0 \le n \le 109).

Output Format(To the terminal/stdout)

Print single integer- the last digit of 1378n.

Sample Input 1

Copy
1
 \n

Sample Output 1

Copy
8
 \n

Sample Input 2

Copy
2
 \n

Sample Output 2

Copy
4
 \n

Hints

In the first example, last digit of 13781=1378 is 8.

In the second example, last digit of 13782=1378 \cdot 1378=1898884 is 4.

Submit

请先 登录

© 2025 FAQs