#include using namespace std; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int H, W, T, sy, sx, gy, gx, prv = -1; cin >> H >> W >> T >> sy >> sx >> gy >> gx; sy--, sx--, gy--, gx--; vector A(H), B; cin >> A; B = A; vector dp(T, vector(H, vector(W))); queue> que; dp[0][sy][sx] = true; que.emplace(0, sy, sx); while(!que.empty()){ auto [t, y, x] = que.front(); que.pop(); if(t > prv){ prv = t; for(int y = 0; y < H; y++){ for(int x = 0; x < W; x++){ if(B[y][x] == '0') B[y][x] = A[y][x]; else B[y][x]--; } } } if(y == gy && x == gx){ cout << "Yes\n"; return 0; } if(t + 1 >= T) continue; for(int i = 0; i < 5; i++){ int ny = y + (i == 0) - (i == 1); int nx = x + (i == 2) - (i == 3); if(ny < 0 || nx < 0 || ny >= H || nx >= W || B[ny][nx] == '0' || dp[t + 1][ny][nx]) continue; dp[t + 1][ny][nx] = true; que.emplace(t + 1, ny, nx); } } cout << "No\n"; }