#include <bits/stdc++.h>
using namespace std;
char ara[100005];
map<int, int> mp;
int main() {
  int t, test;
  long long a, b, c, n;
  char ch;
  double d;
  gets(ara);
  t = strlen(ara);
  int aa = ara[t - 1] - '0';
  int bb = ara[t - 2] - '0';
  aa += (bb * 10);
  if (aa % 4 == 0) {
    cout << "4\n";
  } else {
    cout << "0\n";
  }
  return 0;
}
