#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  if (n == 1) return false;
  if (n == 2) return true;
  for (int i = 2; i * i <= n; ++i)
    if (n % i == 0) return false;
  return true;
}
long long tau(long long n) {
  if (n == 1) return 1;
  if (isPrime(n)) return 2;
  long long ans = 1;
  for (int i = (2); i < (n + 1); ++i) {
    int exp = 0;
    while (n % i == 0) {
      n /= i;
      ++exp;
    }
    ans *= (exp + 1);
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (a % b == 0) return b;
  if (b % a == 0) return a;
  if (a == b) return a;
  if (a == 1 || b == 1) return 1;
  return gcd(max(a, b) % (min(a, b)), min(a, b));
}
int main() {
  string n;
  cin >> n;
  if (n.length() < 2) {
    int t = n[0] - 48;
    if (t % 4 == 0)
      cout << 4;
    else
      cout << 0;
    return 0;
  }
  int last = n[n.length() - 1] - 48;
  int prelast = n[n.length() - 2] - 48;
  if ((prelast * 10 + last) % 4 == 0)
    cout << 4;
  else
    cout << 0;
  return 0;
}
