#include using namespace std; int main() { int x; cin >> x; if((x + 0) % 4 == 0) { cout << 0 << endl; } else if((x + 1) % 4 == 0) { cout << 9 << endl; } else if((x + 2) % 4 == 0) { cout << 18 << endl; } else { cout << 27 << endl; } return 0; }