#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
  point() {}
  point(int _x, int _y) {
    x = _x;
    y = _y;
  }
};
int main() {
  int N, M, K;
  cin >> N >> M >> K;
  vector<vector<char> > arr(N, vector<char>(M));
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < M; ++j) cin >> arr[i][j];
  vector<vector<int> > cost(N, vector<int>(M, -1));
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  --x1;
  --y1;
  --x2;
  --y2;
  cost[x1][y1] = 0;
  queue<point> q;
  q.push(point(x1, y1));
  while (!q.empty()) {
    point curr = q.front();
    q.pop();
    for (int i = 1; i <= K && i + curr.x < N; ++i) {
      if (arr[i + curr.x][curr.y] == '#') break;
      if (cost[i + curr.x][curr.y] == -1) {
        q.push(point(i + curr.x, curr.y));
        cost[i + curr.x][curr.y] = cost[curr.x][curr.y] + 1;
      } else if (cost[curr.x + i][curr.y] <= cost[curr.x][curr.y])
        break;
    }
    for (int i = 1; i <= K && curr.x - i >= 0; ++i) {
      if (arr[curr.x - i][curr.y] == '#') break;
      if (cost[curr.x - i][curr.y] == -1) {
        q.push(point(curr.x - i, curr.y));
        cost[curr.x - i][curr.y] = cost[curr.x][curr.y] + 1;
      } else if (cost[curr.x - i][curr.y] <= cost[curr.x][curr.y])
        break;
    }
    for (int i = 1; i <= K && i + curr.y < M; ++i) {
      if (arr[curr.x][i + curr.y] == '#') break;
      if (cost[curr.x][i + curr.y] == -1) {
        q.push(point(curr.x, i + curr.y));
        cost[curr.x][i + curr.y] = cost[curr.x][curr.y] + 1;
      } else if (cost[curr.x][curr.y + i] <= cost[curr.x][curr.y])
        break;
    }
    for (int i = 1; i <= K && curr.y - i >= 0; ++i) {
      if (arr[curr.x][curr.y - i] == '#') break;
      if (cost[curr.x][curr.y - i] == -1) {
        q.push(point(curr.x, curr.y - i));
        cost[curr.x][curr.y - i] = cost[curr.x][curr.y] + 1;
      } else if (cost[curr.x][curr.y - i] <= cost[curr.x][curr.y])
        break;
    }
  }
  cout << cost[x2][y2];
  return 0;
}
