#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s;
  cin >> s;
  int n = (s[s.size() - 1] - '0');
  if (s.size() > 1) {
    n += (10 * (s[s.size() - 2] - '0'));
  }
  if (n % 4 == 0) {
    cout << 4;
  } else {
    cout << 0;
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
