#include <bits/stdc++.h>
using namespace std;
int dx8[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy8[] = {-1, 1, 0, 0, -1, -1, 1, 1};
int dy[] = {1, -1, 0, 0};
int dx[] = {0, 0, 1, -1};
int X[6] = {0, 0, 0, -1, 0, 1};
int Y[6] = {0, 0, -1, 0, 1, 0};
int Z[6] = {1, -1, 0, 0, 0, 0};
int main() {
  string str;
  char s[100005];
  scanf("%s", s);
  str = s;
  int n = 0;
  for (int i = 0; i < str.size(); i++) {
    n *= 10;
    n += (str[i] - '0');
    n %= 4;
  }
  if (n)
    puts("0");
  else
    puts("4");
}
