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