#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int num;
  cin >> str;
  str = "00" + str;
  num = (str[str.length() - 2] - '0') * 10 + (str[str.length() - 1] - '0');
  if (!(num % 4)) {
    cout << 4 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}
