b(x,y){return(x<3&&y<3)?!(x&y&1):b(x/3,y/3)*b(x%3,y%3);}i,j,l;main(){l=scanf("%\ d",&i);while(i--)l*=3;for(j=0;j