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