#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=5e5+5;
const int mod=1000000000+7;
const int inf=0x3f3f3f3f;
int h,w;
char g[5050][5050];
ll x[5050][5050],y[5050][5050],z[5050][5050];
ll dp[5050][5050];
int main(){
    scanf("%d%d",&h,&w);
    for(int i=1;i<=h;i++)
        scanf("%s",g[i]+1);
    dp[1][1]=1;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(i==1&&j==1) continue;
            if(g[i][j]=='#') continue;
            x[i][j]=(x[i][j-1]+dp[i][j-1])%mod;
            y[i][j]=(y[i-1][j]+dp[i-1][j])%mod;
            z[i][j]=(z[i-1][j-1]+dp[i-1][j-1])%mod;
            dp[i][j]=(x[i][j]+y[i][j]+mod)%mod;
            dp[i][j]=(dp[i][j]+z[i][j]+mod)%mod;
        }
    }
    printf("%lld",dp[h][w]);
}
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int H,W;
string S[10];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W;
	FOR(y,H) cin>>S[y];
	int ret=0;
	
	FOR(y,H-1) FOR(x,W-1) {
		if(S[y][x]=='#'&&S[y+1][x]=='.'&&S[y][x+1]=='.') ret++;
		if(S[y][x+1]=='#'&&S[y+1][x+1]=='.'&&S[y][x]=='.') ret++;
		if(S[y+1][x]=='#'&&S[y][x]=='.'&&S[y+1][x+1]=='.') ret++;
		if(S[y+1][x+1]=='#'&&S[y][x+1]=='.'&&S[y+1][x]=='.') ret++;
		if((S[y][x]=='#')+(S[y][x+1]=='#')+(S[y+1][x]=='#')+(S[y+1][x+1]=='#')==3) ret++;
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
