main=interact$(0%).map(foldr(&)0).lines ' '&v=v*49 _&v=v*49+1 x%(y:z)=(x+y*7)%[]++(y*157)%z 0%_="\n" x%y=" _||"!!length[1,3..mod x 7]:div x 7%y