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