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