#include <bits/stdc++.h>
using namespace std;
char str[100005];
int main() {
  while (~scanf("%s", str)) {
    int len = strlen(str);
    int flag;
    if (len == 1) {
      flag = str[len - 1] - '0';
    } else {
      flag = str[len - 1] - '0' + (str[len - 2] - '0') * 10;
    }
    if (flag % 4 == 0) {
      cout << "4" << endl;
    } else {
      cout << "0" << endl;
    }
  }
  return 0;
}
