#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[100005];
  cin >> s;
  int p = 0, len = strlen(s);
  int j = max(len - 2, 0);
  for (int i = j; i < len; i++) p = p * 10 + s[i] - '0';
  if (p % 4 == 0)
    puts("4");
  else
    puts("0");
  return 0;
}
