#include <bits/stdc++.h>
int main() {
  int a, s, d, f, c, x;
  char v[100002];
  while (scanf("%s", v) == 1) {
    a = strlen(v);
    c = 0;
    for (s = 0; s < a; s++) {
      d = (10 * c) + (int)(v[s] - '0');
      c = d % 4;
    }
    if (c == 0)
      printf("4\n");
    else
      printf("0\n");
  }
  return 0;
}
