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