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