#P1246. ykc`s easy exam

ykc`s easy exam

Problem Description

        One day, YKC his most love the teacher, the teacher heard today to put the film, called the hunt for the barbarians, the name is really strange, like action movies, did not think it was a comedy, oh, no matter, can see a movie is good, but the teacher is naughty we don't want to so easily see this movie, so he thought of a good math (well, the original foreigner is such a love, he felt a certain Mathematics) someone can answer, the problem is that, to give you a fixed number: 1378. And then give you a n, so you ask the last digit of 1378^n is how much.. It sounds very simple, but it won't come out ah, how could feel so much number counted out, but there is a very clever girl out, know the answer after YKC feel the whole body is hollowed out, the original is so simple。。。

Input Format

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

Output Format

Print single integer — the last digit
1
8

Source

2016周赛 七