#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  cin >> s;
  bool multiple_of_4;
  if (s.size() == 1) {
    if (s[0] == '0' || s[0] == '4' || s[0] == '8')
      multiple_of_4 = true;
    else
      multiple_of_4 = false;
  } else {
    int n = (s[s.size() - 1] - '0') + 10 * (s[s.size() - 2] - '0');
    if (n % 4 == 0)
      multiple_of_4 = true;
    else
      multiple_of_4 = false;
  }
  if (multiple_of_4)
    cout << 4 << endl;
  else
    cout << 0 << endl;
}
