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