#include<bits/stdc++.h>
using namespace std;
#define ll   long long int
#define T int t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define PI 3.141592653589793238462643383
#define pb push_back
#define all(s) s.begin(),s.end()


int main (){
    fast;

    int h,w;
    cin>>h>>w;
    string arr[h];

    for(int i=0;i<h;i++){
        cin>>arr[i];
    }
    
    int ans = 0;

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(arr[i][j] == '.'){
                  if(j+1 < w and arr[i][j+1] =='.') ans++;
                if(i+1 < h and arr[i+1][j] == '.') ans++;
            }
              
        }
    }

    cout<<ans<<endl;
    
   

}
/*************************************************************************
	> File Name: 1.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/10/10 20:03:44
 ************************************************************************/
#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define pb push_back
#define pr pair<int,int>
#define fi first
#define se second
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
int n,m,ans=0;
char s[250][250];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	n=read(); m=read();
	For(i,1,n) scanf("%s",s[i]+1);
	For(i,1,n) For(j,1,m){
		if(s[i][j]=='.'){
			if(s[i+1][j]=='.') ++ans;
			if(s[i][j+1]=='.') ++ans;
		}
	}
	printf("%d\n",ans);
	return 0;
}
