#include <bits/stdc++.h>
using namespace std;
char s[100005];
int len;
int main() {
  cin.getline(s, 100005);
  len = strlen(s);
  if (len == 1) s[1] = s[0], s[0] = '0', len++;
  int num = (s[len - 2] - '0') * 10 + (s[len - 1] - '0');
  if (num % 4 == 0)
    printf("4\n");
  else
    printf("0\n");
  return 0;
}
