#include <fstream>
using namespace std;
ifstream cin("backbarn.in");
ofstream cout("backbarn.out");
char a[6][6];
int h,l,b,ans=0;
void dfs(int step,int x,int y)
{
int r;
if (step>b||(x==h&&l==y))
{
if (x==h&&y==l) ans++;
}else
{
for (r=1;r<=4;r++)
{
if (r==1)
if (x<h&&a[x+1][y]!='T') dfs(step+1,x+1,y);
if (r==2)
if (y<l&&a[x][y+1]!='T') dfs(step+1,x,y+1);
if (r==3)
if (x>1&&a[x-1][y]!='T') dfs(step+1,x-1,y);
if (r==4)
if (y>1&&a[x][y-1]!='T') dfs(step+1,x,y-1);
}
}
}
int main()
{
int i,j;
cin>>h>>l>>b;
for (i=1;i<=h;i++)
for (j=1;j<=l;j++) cin>>a[i][j];
dfs(1,1,1);
cout<<ans<<endl;
return 0;
}