跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F1004. Arpa’s hard exam and Mehrdad’s naive cheat

  • ID: 1010
  • 传统题
  • 2000ms
  • 256MiB
  • 尝试: 0
  • AC · 已通过: 0
  • 教学难度:入门
  • 上传者:
  • 模拟
  • 数学
  • 数论
  • 编程与模拟
  • 入门
  • 难度
  • 共享题库
  • Codeforces
  • 英文题面
  • 题目来源
  • 题面语言

Arpa’s hard exam and Mehrdad’s naive cheat

题目描述

A. Arpa’s hard exam and Mehrdad’s naive cheat
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

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≤109).

Output

Print single integer− the last digit of 1378n.

Examples
Input
1
Output
8
Input
2
Output
4
Note

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

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


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 452 题。保留原作者与原赛事署名。