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