#include <bits/stdc++.h>
const int N = 1000070;
using namespace std;
int main(int argc, char const *argv[]) {
  int i, j, k, m, n = 0;
  string s;
  cin >> s;
  if (s[s.size() - 2]) n = (s[s.size() - 2] - 48) * 10;
  n += s[s.size() - 1] - 48;
  if (n % 4 == 0)
    printf("4\n");
  else
    printf("0\n");
  return 0;
}
