3104.Fedya and Maths

Time Limit: 1s Memory Limit: 256MB

Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:
(1n+2n+3n+4n)mod5
for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).

Input Format(From the terminal/stdin)

The single line contains a single integer n (0 \le n \le 10105). The number doesn't contain any leading zeroes.

Output Format(To the terminal/stdout)

Print the value of the expression without leading zeros.

Sample Input 1

Copy
4
 \n

Sample Output 1

Copy
4
 \n

Sample Input 2

Copy
124356983594583453458888889
                           \n

Sample Output 2

Copy
0
 \n

Hints

Operation xmody means taking remainder after division x by y.

Note to the first sample:

3104_1.png

Submit

请先 登录

© 2025 FAQs