#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string n;
  cin >> n;
  int len = n.size();
  int temp = 0;
  int count = 0;
  for (int i = len - 1; i >= 0; i--) {
    temp = (n[i] - '0') * pow(10, count) + temp;
    count++;
    if (count == 2) break;
  }
  if (temp % 4 == 0)
    cout << 4 << endl;
  else
    cout << 0 << endl;
  return 0;
}
