#include <bits/stdc++.h>
using namespace std;
int func(char a, char b) { return ((a - 48) * 10 + (b - 48)); }
int main(int argc, char** argv) {
  char* str = new char[1000000];
  cin >> str;
  long long len = strlen(str);
  int x = 5;
  if (len >= 2)
    x = func(str[len - 2], str[len - 1]);
  else
    x = func('0', str[len - 1]);
  if (x % 4 == 0)
    cout << "4";
  else
    cout << "0";
  return 0;
}
