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