/*
                                        //     //     //\\\\\\\\\
                                        \\    //      \\        \\
                                        //   //       //         \\
                                        \\  //        \\          \\
                                        // //         //           \\
                                        \\//          \\            \\       
                                        //\\          //            //
                                        \\ \\         \\           //
                                        //  \\        //          //
                                        \\   \\       \\         //
                                        //    \\      //        //
                                        \\     \\     \\/////////
*/

#include <bits/stdc++.h>
//#include <boost/math/common_factor.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vint vector <int>
#define vll vector <long long int>
#define endl cout<<'\n'
#define fre(i,l,n) for(long long int i=l;i<n;++i)
#define fr(i,l,n) for(long long int i=l;i<=n;i++)
#define rfre(i,n,l) for(long long int i=n-1;i>=l;i--)
#define rfr(i,n,l) for(long long int i=n;i>=l;--i)
#define tab '\t'
#define debug cout<<'*';
#define s(a) cin>>a
#define p(a) cout<<a
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> pll;
typedef pair<int,pair<int,int> > tii;
typedef vector<int> vec;
typedef vector<long long> vecll;
typedef vector<pair<int,int> > vec_pii;
typedef vector<pair<long long int,long long int> > vec_pll;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvll;
typedef vector<vector<pair<int,int> > > vvpii;
typedef vector<vector<pair<ll,ll> > > vvpll;
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define Pi 3.14159265358979
#define gcd(a,b) __gcd(a,b)
#define sf(n) scanf("%lld",&(n))
#define pf(n) printf("%lld\n",(n))
#define min3(a,b,c) (min((c),min((a),(b))))
#define max3(a,b,c) (max((a),max((b),(c))))
#define w(t) while(t--)
#define flt(a) cout<<fixed<<setprecision(a)
#define cntSetBits(n) __builtin_popcountll(n)
/*****************************
*****************************/

const ll inf = 1000000007;




void solve()
{
    ll n,m,k;
    s(n);s(m);s(k);
    ll x1,y1,x2,y2;
    s(x1);s(y1);s(x2);s(y2);
    ll kd[n+1][m+1];
    fr(i,1,n)
    {
        fr(j,1,m)
        {
            char ch;
            s(ch);
            kd[i][j] = (ch == '.');
        }
    }
    ll dx[] = {-1,0,0,1};
    ll dy[] = {0,-1,1,0};
    ll pm[n+1][m+1];
    memset(pm,inf,sizeof(pm));
    queue<pll> Q;
    Q.push({x1,y1});
    pm[x1][y1] = 0;
    ll ans = -1;
    while(!Q.empty())
    {
        pll sks= Q.front();
        Q.pop();
        if(sks.ff == x2 && sks.ss == y2)
        {
            ans = pm[x2][y2];
            break;
        }
        ll cost = pm[sks.ff][sks.ss] + 1;
        fre(i,0,4)
        {
            fr(j,1,k)
            {
                ll x = sks.ff + j*dx[i];
                ll y = sks.ss + j*dy[i];
                if(x > 0 && y > 0 && x <= n && y <=  m && !kd[x][y])
                {
                    break;
                }
                if(x > 0 && y > 0 && x <= n && y <=  m && pm[x][y] < cost)
                {
                    break;
                }
                if(x > 0 && y > 0 && x <= n && y <=  m && cost < pm[x][y])
                {
                    pm[x][y] = cost;
                    Q.push({x,y});
                }
            }
        }
    }
    p(ans);endl;
}



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll t=1;
    // s(t);
    w(t)
    {
        solve();
    }
    return 0;
}









Measured memory_bytes: 27112