#include <bits/stdc++.h>
using namespace std;
int main() {
  char str[100005];
  char last_str;
  int ans = 0;
  scanf("%s", str);
  int length_str = strlen(str);
  if (length_str == 1) {
    if ((str[0] - '0') % 4 == 0) {
      cout << 4 << endl;
    } else {
      cout << 0 << endl;
    }
  } else {
    int last = str[length_str - 1] - '0';
    int prelast = str[length_str - 2] - '0';
    if ((str[length_str - 1] - '0') % 2 == 1) {
      cout << 0 << endl;
    } else {
      if (last == 2 || last == 6) {
        if (prelast % 2 == 1) {
          cout << 4 << endl;
        } else {
          cout << 0 << endl;
        }
      } else {
        if (prelast % 2 == 1) {
          cout << 0 << endl;
        } else {
          cout << 4 << endl;
        }
      }
    }
  }
}
