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