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