#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 6;
long long int arr[2000005], brr[2000005], crr[2000005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int l = s.size();
  int paici = s[l - 1] - '0';
  paici += (s[l - 2] - '0') * 10;
  if (paici % 4 == 0)
    cout << "4" << endl;
  else
    cout << "0" << endl;
}
