#include <bits/stdc++.h>
using namespace std;
int slowsolve(int n) { return 1 + pow(2.0, n) + pow(3.0, n) + pow(4.0, n); }
int fastsolve(int n) {
  if (n % 4)
    return 4;
  else
    return 0;
}
int main() {
  string s;
  cin >> s;
  char pr = (s.length() > 1) ? s[s.length() - 2] : '0';
  char c = s[s.length() - 1];
  int a = (pr - 48) * 10 + (c - 48);
  if (a % 4 == 0)
    cout << 4;
  else
    cout << 0;
}
