#include <bits/stdc++.h>
using namespace std;
char temp[1000010];
int a[4] = {4, 0, 0, 0};
int Mod() {
  int len = strlen(temp);
  int y = 0;
  for (int i = 0; i < len; i++) {
    y = (y * 10 + (temp[i] - '0')) % 4;
  }
  return y;
}
int main() {
  while (~scanf("%s", temp)) {
    int sum = a[Mod()];
    printf("%d\n", sum);
  }
  return 0;
}
