#include <bits/stdc++.h>
using namespace std;
string a;
int var(char c) { return c - '0'; }
int main() {
  cin >> a;
  int num = 0, ans = 0;
  if (a.size() == 1)
    num = var(a[0]);
  else
    num = var(a[a.size() - 1]) + 10 * var(a[a.size() - 2]);
  num = num % 4;
  if (num == 0) ans = 4;
  if (num == 1) ans = 0;
  if (num == 2) ans = 0;
  if (num == 3) ans = 0;
  cout << ans << endl;
}
