#include using namespace std; using ll = long long; int H, W, T; int gx, gy; int A[220][220], B[220][220]; bool dp[210][210], ndp[210][210]; int dx[5] = {0, 1, 0, -1}; int dy[5] = {1, 0, -1, 0}; template void Fill(A (&arr)[N], const T &val){ fill((T*)arr, (T*)(arr + N), val); } bool inside(int x, int y){ return 0 <= x && x < H && 0 <= y && y < W; } int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> H >> W >> T; { int x, y; cin >> x >> y; x--, y--; dp[x][y] = true; } cin >> gx >> gy; gx--, gy--; for(int i = 0;i < H;i++){ string s; cin >> s; for(int j = 0;j < W;j++){ int v = s[j] - '0'; A[i][j] = B[i][j] = v; } } for(int t = 1;t < T;t++){ if(dp[gx][gy])break; //cout << t << " # \n"; for(int x = 0;x < H;x++){ for(int y = 0;y < W;y++){ //cout << dp[x][y] << " \n"[y + 1 == W]; } } for(int x = 0;x < H;x++){ for(int y = 0;y < W;y++){ B[x][y] = (A[x][y] + B[x][y]) % (A[x][y] + 1); //cout << B[x][y] << " \n"[y + 1 == W]; } } for(int x = 0;x < H;x++){ for(int y = 0;y < W;y++){ for(int d = 0;d < 5;d++){ int nx = x + dx[d], ny = y + dy[d]; if(!inside(nx, ny))continue; if(B[nx][ny] == 0)continue; ndp[nx][ny] |= dp[x][y]; } } } swap(dp, ndp); Fill(ndp, 0); for(int x = 0;x < H;x++){ for(int y = 0;y < W;y++){ //cout << dp[x][y] << " \n"[y + 1 == W]; } } } cout << (dp[gx][gy] ? "Yes\n" : "No\n"); return 0; }