# include<iostream> using namespace std; int main(){ int y; cin>>y; if(y%4==0){ cout<<4; } else { cout<<4-(y%4); } return 0; }