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