#include <bits/stdc++.h>
using namespace std;

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> S(H, vector<char>(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++)
    	cin >> S.at(i).at(j);
  }
  
  int count=0;
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W-1; j++){
      if(S.at(i).at(j)=='.' && S.at(i).at(j+1)=='.')
        count++;
    }
  }
  
   for(int i=0; i<H-1; i++){
    for(int j=0; j<W; j++){
      if(S.at(i).at(j)=='.' && S.at(i+1).at(j)=='.')
        count++;
    }
  }
  
  cout << count << endl;

}

#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;
//using namespace atcoder;

void solve(){
	int h,w;
	cin>>h>>w;
	vector<string>s(h);
	rep(i,h)cin>>s[i];
	int ans=0;
	rep(i,h)rep(j,w-1)if(s[i][j]=='.'&&s[i][j+1]=='.')++ans;
	rep(i,h-1)rep(j,w)if(s[i][j]=='.'&&s[i+1][j]=='.')++ans;
	cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}
