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