#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int h,w;cin>>h>>w;
    VS s(h);
    REP(i,h){
        cin>>s[i];
    }

    LL result = 0;
    REP(i,h){
        REP(j,w){
            if(i+1 < h){
                if(s[i][j] == '.' && s[i+1][j] == '.'){
                    result++;
                }
            }
            if(j+1 < w){
                if(s[i][j] == '.' && s[i][j+1] == '.'){
                    result++;
                }
            }
        }
    }
    cout<<result<<endl;

    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}
#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;
ll MOD = 1000000007;
int main(){
  int H,W;
  cin>>H>>W;
  vector<vector<char>> s(H,(vector<char>(W)));
  for(int i=0;i<H;i++) for(int j=0;j<W;j++) cin>>s[i][j];
  vector<vector<ll>> dp(H,(vector<ll>(W)));
  vector<vector<ll>> dpx(H,(vector<ll>(W)));
  vector<vector<ll>> dpy(H,(vector<ll>(W)));
  vector<vector<ll>> dpxy(H,(vector<ll>(W)));
  dp[H-1][W-1] = 1;

  for(int i=H-1;i>=0;i--){
    for(int j=W-1;j>=0;j--){
      if(s[i][j]=='#') continue;
      dp[i][j] += (dpx[i][j]%MOD + dpy[i][j]%MOD + dpxy[i][j]%MOD)%MOD;
      if(j!=0) dpx[i][j-1] = dpx[i][j]+dp[i][j];
      if(i!=0) dpy[i-1][j] = dpy[i][j]+dp[i][j];
      if(i!=0&&j!=0) dpxy[i-1][j-1] = dpxy[i][j]+dp[i][j];
    }
  }
  cout<<dp[0][0]<<"\n";
  /*
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      printf("%11lld",dp[i][j]);
    }
    cout<<"\n";
  }
  */
}