#include <bits/stdc++.h> using namespace std; /* typedef */ typedef long long ll; typedef pair<int, int> pii; /* constant */ const int INF = 1 << 30; const ll LINF = 1LL << 50; const int NIL = -1; const int MAX = 10000; const int mod = 1000000007; const double pi = 3.141592653589; /* global variables */ /* function */ /* main */ int main(){ string S; cin >> S; int last2Digits = 0; for (int i = S.size() - 1, p = 1; i >= 0; i--, p *= 10) { last2Digits += (S[i] - '0') * p; } int last1Digits = S[S.size() - 1] - '0'; // S == (偶数) && (Not 4の倍数) => not exist if ((last2Digits % 4 != 0) && (last1Digits % 2 == 0)) { cout << -1 << '\n'; } // S == 1 or 4 => not exist else if (S == "1" || S == "4") cout << -1 << '\n'; // otherwise exist else cout << 1 << '\n'; }