#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int l, n, m;
  l = s.size();
  if (l == 1) {
    if (s[0] == '4' || s[0] == '8' || s[0] == '0') {
      cout << "4" << endl;
    } else {
      cout << "0" << endl;
    }
  } else {
    n = s[l - 2] - 48;
    m = s[l - 1] - 48;
    n = (n * 10) + m;
    if (n % 4 == 0) {
      cout << "4" << endl;
    } else {
      cout << "0" << endl;
    }
  }
}
