#include<bits/stdc++.h>
using namespace std;
int main()
{
	int tt=1;
	//cin>>tt;
	while(tt--)
	{
		int r,c,count=0;
		cin>>r>>c;
		char a[r][c];
		for(int i=0;i<r;i++)
		{
			for(int j=0;j<c;j++)
			{
				cin>>a[i][j];
			}
		}
		
			for(int i=0;i<r-1;i++)
		{
			for(int j=0;j<c;j++)
			{
				if(j==c-1)
				{
					if(a[i][j]=='.' and a[i+1][j]=='.')
					count++;
				}
				else
				{
					if((a[i][j]=='.' and a[i+1][j]=='.'))
					count++;
					if((a[i][j]=='.' and a[i][j+1]=='.'))
					count++;
				}
				
			}
		}
		for(int i=0;i<c-1;i++)
		{
			if(a[r-1][i]=='.' and a[r-1][i+1]=='.')
			count++;
		}
		cout<<count;
		cout<<"\n";
	}
	return 0;
}
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N,M;
char S[110][110];

signed main(){
	cin>>N>>M;
	REP(i,N){
		cin>>S[i];
	}
	int ans=0;
	REP(i,N){
		REP(j,M-1){
			if(S[i][j]=='.'&&S[i][j+1]=='.'){
				ans++;
			}
		}
	}
	REP(i,M){
		REP(j,N-1){
			if(S[j][i]=='.'&&S[j+1][i]=='.'){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}
