#include <bits/stdc++.h>
using namespace std;
int vis[1005][1005][5] = {0};
char a[1005][1005];
int n, m, k;
int X[4] = {0, 1, 0, -1};
int Y[4] = {-1, 0, 1, 0};
int issafe(int x, int y, int i) {
  if (x >= 0 && x < n && y >= 0 && y < m && a[x][y] == '.' && vis[x][y][i] == 0)
    return 1;
  else
    return 0;
}
int main() {
  int sx, sy, dx, dy, flag = 0, ans = 0;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
  }
  cin >> sx >> sy >> dx >> dy;
  sx--, sy--, dx--, dy--;
  queue<pair<pair<int, int>, int> > q;
  q.push(make_pair(make_pair(sx, sy), 0));
  while (!q.empty()) {
    pair<pair<int, int>, int> p = q.front();
    q.pop();
    if (p.first.first == dx && p.first.second == dy) {
      flag = 1;
      cout << p.second << endl;
      break;
    }
    ans = p.second + 1;
    int x = p.first.first, y = p.first.second;
    for (int i = 0; i < k; i++) {
      if (issafe(x + X[0], y + Y[0], 0)) {
        q.push(make_pair(make_pair(x + X[0], y + Y[0]), ans));
        x = x + X[0];
        y = y + Y[0];
        vis[x][y][0] = 1;
      } else
        break;
    }
    x = p.first.first, y = p.first.second;
    for (int i = 0; i < k; i++) {
      if (issafe(x + X[1], y + Y[1], 1)) {
        q.push(make_pair(make_pair(x + X[1], y + Y[1]), ans));
        x = x + X[1];
        y = y + Y[1];
        vis[x][y][1] = 1;
      } else
        break;
    }
    x = p.first.first, y = p.first.second;
    for (int i = 0; i < k; i++) {
      if (issafe(x + X[2], y + Y[2], 2)) {
        q.push(make_pair(make_pair(x + X[2], y + Y[2]), ans));
        x = x + X[2];
        y = y + Y[2];
        vis[x][y][2] = 1;
      } else
        break;
    }
    x = p.first.first, y = p.first.second;
    for (int i = 0; i < k; i++) {
      if (issafe(x + X[3], y + Y[3], 3)) {
        q.push(make_pair(make_pair(x + X[3], y + Y[3]), ans));
        x = x + X[3];
        y = y + Y[3];
        vis[x][y][3] = 1;
      } else
        break;
    }
  }
  if (!flag) cout << "-1" << endl;
  return 0;
}
