#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
void palindrome(string s) {
  int i = 0;
  int j = s.size() - 1;
  while (i < j) {
    if (s[i] != s[j]) return;
    i++;
    j--;
  }
  cout << s;
  exit(0);
}
int recursive(int n, int a[]) {
  int x = 1;
  if (a[n] != 0) return a[n];
  if (n < 10) return n;
  while (n != 0) {
    if (n % 10 != 0) x = x * (n % 10);
    n = n / 10;
  }
  return recursive(x, a);
}
int myXOR(int x, int y) { return (x | y) & (~x | ~y); }
int main() {
  string s;
  cin >> s;
  int a, b;
  if (s.size() >= 2) {
    a = s[s.size() - 2] - '0';
    b = s[s.size() - 1] - '0';
    a = 10 * a + b;
    if (a % 4 == 0)
      cout << 4;
    else
      cout << 0;
  }
  if (s.size() == 1) {
    int x = s[0] - '0';
    if (x % 4 == 0)
      cout << 4;
    else
      cout << 0;
  }
}
