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