m@main=do x<-readLn;mapM(putStrLn.take 5.(`drop`"1 0 1 0 0 0 1"))[8%4!!x,[6,2,6,2,6,2,0]!!x,4%8!!x,13];m x%y=[0,6,x,y,0,0,0]