#include <bits/stdc++.h>
using namespace std;
int main() {
  string num;
  cin >> num;
  int len = num.length();
  int arr[len];
  for (int i = 0; i < len; i++) {
    arr[i] = num[i] - '0';
  }
  int temp = arr[len - 2] * 10 + arr[len - 1];
  if (temp % 4 == 0) {
    cout << "4"
         << "\n";
  } else
    cout << "0"
         << "\n";
}
