#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
int n;
int main() {
  char a1[1020000];
  int a[1020000], x = 0, c[1020000];
  scanf("%s", &a1);
  int L = strlen(a1), L1 = 1;
  int i, j;
  for (i = 1; i <= L; i++) a[i] = a1[i - 1] - '0';
  for (i = 1; i <= L; i++) {
    c[i] = (x * 10 + a[i]) / 4;
    x = (x * 10 + a[i]) % 4;
  }
  while (c[L1] == 0 && L1 < L) L1++;
  if (x == 0)
    cout << 4 << endl;
  else
    cout << 0 << endl;
  return 0;
}
