#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int INF = 1e9 + 5;
const long long mod = 1e9 + 7;
const double pi = 3.1415926536;
int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  string s;
  cin >> s;
  int x = (s[s.size() - 1] - '0');
  int y = (s.size() == 1 ? 0 : s[s.size() - 2] - '0');
  x = (y * 10 + x) % 4;
  if (x == 0) cout << 4 << endl;
  if (x == 1) cout << 0 << endl;
  if (x == 2) cout << 0 << endl;
  if (x == 3) cout << 0 << endl;
  return 0;
}
