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; } ll l=lcm(h,w); k%=2*l; if(k>=l){ k=2*l-k; } y=x=0; rep(k){ s[y<0?~y:y][x<0?~x:x]^='.'^'#'; if(++y==h) y=-h; if(++x==w) x=-w; } wtLn(s(h));