#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std ;
typedef long long ll ;
const int mod=1000000007 ;

void solve(){

	int r,c ;
	cin>>r>>c ;

	char arr[r][c] ;

	rep(i,r){
		rep(j,c){
			cin>>arr[i][j] ;
		}
	}

	ll count=0 ;

	rep(i,r){
		rep(j,c-1){
			if(arr[i][j]=='.' && arr[i][j+1]=='.'){
				count++ ;
			}
		}
	}

	rep(i,r-1){
		rep(j,c){
			if(arr[i][j]=='.' && arr[i+1][j]=='.'){
				count++ ;
			}
		}
	}

	cout<<count ;
}

int main(){

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin) ;
	freopen("output.txt", "w", stdout) ;
#endif
	
	cin.tie(0); 
	cout.tie(0);
	ios_base::sync_with_stdio(false);
	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}
#include<bits/stdc++.h>
using namespace std;
char a,b;
int main(){
	cin>>a>>b;
	if(a=='Y'&&b=='a')cout<<"A";
	if(a=='Y'&&b=='b')cout<<"B";
	if(a=='Y'&&b=='c')cout<<"C";
	if(a=='Y'&&b=='A')cout<<"A";
	if(a=='Y'&&b=='B')cout<<"B";
	if(a=='Y'&&b=='C')cout<<"C";
	
	if(a=='N'&&b=='a')cout<<"a";
	if(a=='N'&&b=='b')cout<<"b";
	if(a=='N'&&b=='c')cout<<"c";
	if(a=='N'&&b=='A')cout<<"a";
	if(a=='N'&&b=='B')cout<<"b";
	if(a=='N'&&b=='C')cout<<"c";
	return 0;
}