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