#include <bits/stdc++.h>
char str[9999999];
int main() {
  while (~scanf("%s", str)) {
    int l = strlen(str);
    int rem = 0;
    for (int i = 0; i < l; i++) {
      rem = rem * 10 + str[i] - '0';
      rem = rem % 4;
    }
    if (rem == 0)
      printf("4\n");
    else
      printf("0\n");
  }
  return 0;
}
