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