#include <bits/stdc++.h>
using namespace std;
int main() {
  string num;
  int finalResult = 0;
  int one[5] = {1, 1, 1, 1};
  int two[5] = {1, 2, 4, 3};
  int three[5] = {1, 3, 4, 2};
  int four[5] = {1, 4, 1, 4};
  cin >> num;
  int result = 0;
  for (int i = 0; i < num.size() - 1; i++) {
    int digit = num[i] - '0';
    result = (result % 4 + digit % 4) % 4;
    result = (result % 4 * 10 % 4) % 4;
  }
  result = (result % 4 + (num[num.size() - 1] - '0') % 4) % 4;
  if (result == 0) {
    finalResult = 4;
  } else {
    finalResult = 0;
  }
  cout << finalResult << endl;
  return 0;
}
