#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string a;
  cin >> a;
  int ac = 1, num = 0;
  for (int i = a.length() - 1; i >= 0 && a.length() - i < 3; i--) {
    num += ac * (a[i] - '0');
    ac *= 10;
  }
  if (num & 3)
    cout << "0\n";
  else
    cout << "4\n";
  return 0;
}
