303847: CF742A. Arpa’s hard exam and Mehrdad’s naive cheat

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Arpa’s hard exam and Mehrdad’s naive cheat

题意翻译

题目描述: 给你一个数N,问你1378的N次幂个位是多少 输入输出格式: 输入格式:一行,一个数:N 输出格式:一行,一个数字:1378的N次幂个位 说明: 在第一个样例,1378^1是1378,所以个位是8 在第二个样例,1378^2是1898884,所以个位是4

题目描述

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} $ . ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF742A/ab9ba8346f663bae0aee759b2cc434974bb6a568.png)Mehrdad has become quite confused and wants you to help him. Please help, although it's a naive cheat.

输入输出格式

输入格式


The single line of input contains one integer $ n $ ( $ 0<=n<=10^{9} $ ).

输出格式


Print single integer — the last digit of $ 1378^{n} $ .

输入输出样例

输入样例 #1

1

输出样例 #1

8

输入样例 #2

2

输出样例 #2

4

说明

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

题意翻译

题目描述: 给你一个数N,问你1378的N次幂个位是多少 输入输出格式: 输入格式:一行,一个数:N 输出格式:一行,一个数字:1378的N次幂个位 说明: 在第一个样例,1378^1是1378,所以个位是8 在第二个样例,1378^2是1898884,所以个位是4

加入题单

上一题 下一题 算法标签: