#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>

int main() {
	int h, w;
	cin >> h >> w;
	vector<string>s(h);
	rep(i, h) {
		cin >> s[i];
	}
	ll ans(0);
	
	rep(i, h) {
		bool ok = false;
		rep(j, w) {
			if (ok && s[i][j] == '.')ans++;
			else if (s[i][j] == '.')ok = true;
			else if (s[i][j] == '#')ok = false;
		}
	}
	rep(i, w) {
		bool ok = false;
		rep(j, h) {
			if (ok && s[j][i] == '.')ans++;
			else if (s[j][i] == '.')ok = true;
			else if (s[j][i] == '#')ok = false;
		}
	}
	cout << ans;
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(0); cin.tie(0);
  int h, w, count=0; cin >> h >> w;
  vector<string> str; 
  for(int i=0;i<h;i++) {
    string s; cin >> s;
    str.push_back(s);
  }
  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      if(str[i][j] == '.' && str[i][j] == str[i][j+1]) count++;
    }
  }
  for(int i=1;i<h;i++) {
    for(int j=0;j<w;j++) {
      if(str[i][j] == '.' && str[i][j] == str[i-1][j]) count++;
    }
  }
  cout << count << endl;
  return 0; 
}
