#include <bits/stdc++.h>
using namespace std;
int main() {
  string n;
  cin >> n;
  if (n.length() == 1) {
    if (n == "0" || n == "4" || n == "8")
      cout << 4 << endl;
    else
      cout << 0 << endl;
  } else {
    long long int n1 = n[n.length() - 1] - '0';
    long long int n2 = n[n.length() - 2] - '0';
    long long int n3 = n2 * 10 + n1;
    if (n3 % 4 == 0)
      cout << 4 << endl;
    else
      cout << 0 << endl;
  }
}
