#include<iostream>
using namespace std;
int n,m,t,x1,y1,x2,y2;
int X[4]={1,-1,0,0},Y[4]={0,0,1,-1};
bool ok[110][110];
int ans;
inline int abs(int s){
if(s<0)return -s;
return s;
}
inline void dfs(int x,int y,int time){
if(x==x2&&y==y2&&time==0)ans++;
if(!time||abs(x-x2)+abs(y-y2)>time)return;
int i;
for(i=0;i<4;i++)
if(x>=1&&x<=n&&y>=1&&y<=m&&ok[x][y])
dfs(x+X[i],y+Y[i],time-1);
}
int main( ){
std::ios::sync_with_stdio(false);
cin>>n>>m>>t;
int i,j,k;
char c;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++){cin>>c;if(c=='.')ok[i][j]=1;else ok[i][j]=0;}
cin>>x1>>y1>>x2>>y2;
dfs(x1,y1,t);
cout<<ans;
}