#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long r = 0;
  for (int i = 0; i < s.length(); i++) {
    r = r * 10 + (s[i] - '0');
    r %= 4;
  }
  if (!r)
    cout << 4 << endl;
  else
    cout << 0 << endl;
  return 0;
}
