#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define inf 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int n,m;
char tu[105][105];
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        cin>>tu[i]+1;
    int res=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(tu[i][j]=='.'&&tu[i][j-1]=='.')res++;
            if(tu[i][j]=='.'&&tu[i-1][j]=='.')res++;
        }
    }
    cout<<res;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
using P = pair<int,int>;
int main() {
   int h,w;cin>>h>>w;
   vector<string> v;
   string last(w+1,'#');
   rep(i,h){
      string s;cin>>s;
      v.push_back(s);
      v[i].push_back('#');
   }
   int ans=0;
   v.push_back(last);
   rep(i,h){
      rep(j,w){
         if(v[i][j]=='.'){
            ans+=(v[i][j+1]=='.');
            ans+=(v[i+1][j]=='.');
         }
      }
   }
   cout<<ans<<endl;
}