4B: Fedya and Maths

Fedya studies in a gymnasium. Fedya’s maths hometask is to calculate the following expression:

(1^n + 2^n +  3^n  +  4^n) mod 5

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
The single line contains a single integer n (0 ≤ n ≤ 1e105). The number doesn’t contain any leading zeroes.

Output
Print the value of the expression without leading zeros.

Examples

Input

4

Output

4

Input

124356983594583453458888889

Output

0

代码

#include <iostream>
#include <cstring>
using namespace std;

char s[1000005];
int main(){
cin >> s;
int len = strlen(s);
int k;
if(len >=2) k = (s[len-2] -'0')*10 + s[len-1] - '0';
else k = s[len-1]-'0';
if(k%4==0) cout << 4 << endl;
else cout << 0 << endl;

return 0;
}

©️2019 CSDN 皮肤主题: 1024 设计师: 上身试试