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