ll@h,@w,@k,y,x,u,v; char s[h][w+1]; rep(y,h){ rep(x,w){ s[y][x]='.'; } s[y][w]=0; } k%=2*lcm(h,w); y=x=0; v=u=1; rep(k){ s[y][x]^='.'^'#'; if(y+v<0||y+v>=h){ v=-v; }else{ y+=v; } if(x+u<0||x+u>=w){ u=-u; }else{ x+=u; } } wtLn(s(h));