#include <bits/stdc++.h>
using namespace std;
int n, m, k;
char mp[1010][1010];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int vis[1010][1010];
int sx, sy, ex, ey;
struct Node {
  int x, y, dis;
  Node(int xx, int yy, int ddis = 0) : x(xx), y(yy), dis(ddis) {}
};
queue<Node> Q, tempQ;
bool check(int x, int y) { return x >= 0 && x < n && y >= 0 && y < m; }
int bfs() {
  memset(vis, 0, sizeof vis);
  sx -= 1;
  sy -= 1;
  ex -= 1;
  ey -= 1;
  vis[sx][sy] = 1;
  while (!Q.empty()) Q.pop();
  while (!tempQ.empty()) tempQ.pop();
  Q.push(Node(sx, sy));
  int ans = -1;
  while (!Q.empty() || !tempQ.empty()) {
    if (Q.empty()) {
      while (!tempQ.empty()) {
        Node tmp = tempQ.front();
        if (vis[tmp.x][tmp.y] == 0) {
          vis[tmp.x][tmp.y] = 1;
          Q.push(tmp);
        }
        tempQ.pop();
      }
    }
    Node f = Q.front();
    Q.pop();
    if (f.x == ex && f.y == ey) {
      ans = f.dis;
      break;
    }
    for (int i = 0; i < 4; i++) {
      for (int j = 1; j <= k; j++) {
        int curx = f.x + dx[i] * j;
        int cury = f.y + dy[i] * j;
        if (check(curx, cury) && mp[curx][cury] != '#' &&
            vis[curx][cury] == 0) {
          tempQ.push(Node(curx, cury, f.dis + 1));
        } else {
          break;
        }
      }
    }
  }
  return ans;
}
int main(int argc, char *argv[]) {
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    for (int i = 0; i < n; i++) {
      scanf("%s", mp[i]);
    }
    scanf("%d%d%d%d", &sx, &sy, &ex, &ey);
    printf("%d\n", bfs());
  }
  return 0;
}
