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