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