#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535;
long long int n, m;
const int mx = 69;
char grid[mx][mx];
long long int blocked[mx][mx];
long long int vis[mx][mx];
void FAST() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long int power(long long int a, long long int b) {
  long long int res = 1;
  for (int i = 1; i <= b; ++i) res *= a;
  return res;
}
int main() {
  FAST();
  string s;
  cin >> s;
  int num = s[s.size() - 1] + s[s.size() - 2] * 10;
  if (num % 4 == 0 || num == 0) {
    cout << "4\n";
  } else
    cout << "0\n";
}
