#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, digits;
  cin >> s;
  digits.push_back(s.back());
  s.pop_back();
  digits.push_back(s.back());
  int number = 0;
  int ten = 1;
  for (int i = 0; i < 2; i++) {
    number += ten * (digits[i] - 48);
    ten *= 10;
  }
  if (number % 4 == 0)
    cout << 4 << endl;
  else
    cout << 0 << endl;
}
