#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 1;
void test() {
  string s;
  cin >> s;
  int n = s.size();
  int x = s[n - 2] - '0';
  int y = x * 10 + (s[n - 1] - '0');
  if (y % 4 == 0)
    cout << 4 << endl;
  else
    cout << 0 << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  test();
  return 0;
}
