#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);}) #define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;}) #define rep(v,e) for(typeof(e) v=0;v>6]=1ul<>6]^=1ul<>6]^=1ul<>1|v1<<63|v0<<1|0 |d[y+1][0]); d[y][1]=m[0][y][1]&(u1|v1|v1>>1|v2<<63|v1<<1|v0>>63|d[y+1][1]); d[y][2]=m[0][y][2]&(u2|v2|v2>>1|v3<<63|v2<<1|v1>>63|d[y+1][2]); d[y][3]=m[0][y][3]&(u3|v3|v3>>1|0 |v3<<1|v2>>63|d[y+1][3]); u0=v0;u1=v1;u2=v2;u3=v3; } rep3(r,1,10){ if((k+2)%(r+1)==0){ rep(y,h){ rep(x,4){ d[y][x]&=m[r][y][x]; } } } } if(d[gy][gx>>6]&1ul<