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