#include <bits/stdc++.h>
using namespace std;
int main() {
  int x;
  string s;
  cin >> s;
  long long int len = s.size();
  if (len == 1) {
    x = stoi(s);
    x = x % 4;
  } else {
    string r = s.substr(len - 2, len);
    int num = stoi(r);
    x = num % 4;
  }
  if (x == 0)
    cout << 4;
  else
    cout << 0;
}
