#include <bits/stdc++.h>
using namespace std;
int main() {
  string n;
  cin >> n;
  if (n.size() > 1) {
    int a = n[n.size() - 2];
    a *= 10;
    a += n[n.size() - 1];
    if (a % 4 == 0)
      cout << "4";
    else
      cout << "0";
  } else {
    int a = n[0];
    if (a % 4 == 0)
      cout << "4";
    else
      cout << "0";
  }
  return 0;
}
