#include <bits/stdc++.h>
using namespace std;
void start() {}
void sober() {
  long long int n, x = 0, a = 0, b = 0, y = 0, sum = 0, k = 0, m = 0;
  string s;
  cin >> s;
  n = s.length();
  if (n == 1) {
    long long int foo = stoi(s);
    if (foo % 4) {
      cout << "0\n";
    } else
      cout << "4\n";
    return;
  }
  string chc = "";
  chc = chc + s[n - 2] + s[n - 1];
  long long int foo = stoi((chc));
  if (foo % 4) {
    cout << "0\n";
    return;
  }
  cout << "4\n";
  return;
}
signed main() {
  start();
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    sober();
  }
}
