main=interact$g.foldl(\(x,y,d,e,k,l)m->(x+d,y+e,-m*e,m*d,x:k,y:l))(0,0,1,0,[],[]).(iterate h[0]!!).read\x0d h[x]=[-1,x,1]\x0d h(x:y:l)=(-1):x:1:y:h l\x0d g(_,_,_,_,a,b)=unlines[[last(' ':['*'|elem(x,y)(zip a b)])|x<-[m a..n a]]|y<-[m b..n b]]\x0d m=minimum\x0d n=maximum
Note that non-ascii characters in the above source code will be escaped (such as \x9f).