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