#include <bits/stdc++.h>
using namespace std;
long long int mod(string num, long long int a) {
  long long int res = 0;
  for (long long int i = 0; i < num.length(); i++)
    res = (res * 10 + (long long int)num[i] - '0') % a;
  return res;
}
void solve() {
  string s;
  cin >> s;
  long long int req = mod(s, 4);
  if (req == 0) {
    cout << 4 << endl;
    return;
  }
  cout << 0 << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) solve();
  return 0;
}
