#include <bits/stdc++.h>
using namespace std;
const long long oo = 2e9, mod = 1000000007;
std::stringstream ss;
int main() {
  string str;
  cin >> str;
  int n = (int)str.size();
  string temp = n <= 2 ? str : str.substr(n - 2, 2);
  int token;
  ss << temp;
  ss >> token;
  token = token % 4 == 0 ? 4 : 0;
  cout << token << endl;
  return 0;
}
