#include <bits/stdc++.h>
char s[100200];
int main() {
  int n;
  while (scanf("%s", s) != EOF) {
    int ans = 0;
    for (int i = 0; s[i]; i++) ans = (ans * 10 + s[i] - '0') % 4;
    if (ans)
      puts("0");
    else
      puts("4");
  }
}
