#include <bits/stdc++.h>
using namespace std;
static const auto fast = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  return nullptr;
}();
void solve() {
  string s;
  cin >> s;
  long long n = 10 * ((*(s.end() - 2)) - '0') + (*(s.end() - 1) - '0');
  (n % 4) ? cout << 0 : cout << 4;
  return;
}
int32_t main() {
  solve();
  return 0;
}
