#include <bits/stdc++.h>
using namespace std;
char ch[100010];
int main() {
  scanf("%s", ch);
  int len = strlen(ch);
  int a;
  if (len > 1)
    a = ch[len - 1] - '0' + 10 * (ch[len - 2] - '0');
  else
    a = ch[0] - '0';
  if (a % 4)
    cout << 0 << endl;
  else
    cout << 4 << endl;
}
