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