#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int N = s.length(), k = (s[N - 1] - '0');
  if (N > 1) k += (s[N - 2] - '0') * 10;
  if (k % 4 == 0)
    cout << 4 << endl;
  else
    cout << 0 << endl;
  return 0;
}
