#include <bits/stdc++.h>
using namespace std;
int main() {
  string n;
  int rem{};
  cin >> n;
  if (n.size() <= 3)
    rem = stoi(n) % 4;
  else {
    rem = stoi(n.substr(n.size() - 3, 3)) % 4;
  }
  if (rem == 0)
    cout << 4;
  else
    cout << 0;
  return 0;
}
