#include using namespace std; //#include //using namespace atcoder; typedef long long ll; typedef unsigned long long ull; const int MAX = 1e9; const int MIN = -1*1e9; const ll MAXLL = 1e18; const ll MINLL = -1*1e18; //const ll MOD = 998244353; //const ll MOD = 1000000007; string EraseZero(string S) { while(S.size() != 1) { if(S[0] != '0') break; S = S.substr(1); } return S; } int main() { string S; cin >> S; if(S == "1" || S == "4") { cout << -1 << endl; return 0; } if((S[S.size()-1] - '0')%2 != 0) { cout << 1 << endl; return 0; } reverse(S.begin(),S.end()); if(S.size() != 1) S = S.substr(0,2); reverse(S.begin(),S.end()); S = EraseZero(S); cout << (stoi(S)%4==0 ? 1: -1) << endl; return 0; }