#include int main(void){ int in,rslt,tmp=0; scanf("%d",&in); tmp=in%6; switch(tmp){ case 1: rslt=2; break; case 2: rslt=8; break; case 3: rslt=5; break; case 4: rslt=7; break; case 5: rslt=1; break; case 0: rslt=4; break; } printf("%d\n",rslt); return 0; }