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