Codeforces Round 383 (Div. 2)
A
Arpa’s hard exam and Mehrdad’s naive cheat
Codeforces
1000
原题
←B →
翻译中…

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 $1378^{*n*}$.

翻译中…

image

翻译中…

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*}$.

翻译中…

Note

翻译中…

In the first example, last digit of $1378^{1} = 1378$ is $8$.

翻译中…

In the second example, last digit of $1378^{2} = 1378·1378 = 1898884$ is $4$.

翻译中…

样例

Input #1
1
Output #1
8
InputCopy OutputCopy
Input #2
2
Output #2
4
InputCopy OutputCopy
题目信息
题号
742A
时间限制
1 s
内存限制
256 MB
标签
模拟
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。