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