#include "bits/stdc++.h"
using namespace std;

//#define int long long

#define ll long long
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define P pair<ll,ll>
#define ld long double
ll INF = (1LL << 60);
int mod = 1000000007;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s; cin >> s;
	if (s == "1") {
		cout << -1 << endl; return 0;
	}
	int tmp = s[s.size() - 1] - '0';
	if (tmp % 2 == 1) {
		cout << 1 << endl; return 0;
	}
	int n = s.size();
	if (n == 1) {
		if (s=="8") {
			cout << 1 << endl; return 0;
		}
		else {
			cout << -1 << endl; return 0;
		}
	}
	else if(n <= 3){
		int now = 0;
		if (n == 2)now = (s[0] -'0')* 10 + (s[1]-'0');
		else now = (s[0]-'0') * 100 + (s[1]-'0') * 10 + (s[2]-'0');
		if (now % 4 == 0) {
			cout << 1 << endl; return 0;
		}
		else {
			cout << -1 << endl; return 0;
		}
	}
	else {
		int now = (s[n - 1]-'0') + (s[n - 2]-'0') * 10 + (s[n - 3]-'0') * 100;
		if (now % 4 == 0) {
			cout << 1 << endl; return 0;
		}
		else {
			cout << -1 << endl; return 0;
		}
	}
	return 0;
}