#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <fstream>
#include <cassert>
#include <numeric>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;
//using mint = modint;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region 一次元座圧
template <typename T>
vector<T> compress(vector<T> &X)
{
	vector<T> vals = X;
	sort(all(vals));
	vals.erase(unique(all(vals)), vals.end());
	rep(i, (int)X.size())X[i] = lower_bound(all(vals), X[i]) - vals.begin();
	return vals;
}

#pragma endregion
#pragma endregion


int main()
{
	int h, w; cin >> h >> w;
	vector<string> v(h);
	rep(i, h)cin >> v[i];
	int res = 0;
	rep(i, h)rep(j, w - 1)
	{
		if (v[i][j] == '.' && v[i][j + 1] == '.')++res;
	}
	rep(i, h - 1)rep(j, w)
	{
		if (v[i][j] == '.' && v[i + 1][j] == '.')++res;
	}
	cout << res << endl;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
  int h, w, ans = 0;
  cin >> h >> w;
  char s[h][w];
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++)
      cin >> s[i][j];
  for (int i = 0; i < h - 1; i++)
    for (int j = 0; j < w; j++)
      if (s[i][j] == '.' && s[i + 1][j] == '.')
        ans++;
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w - 1; j++)
      if (s[i][j] == '.' && s[i][j + 1] == '.')
        ans++;
  cout << ans;
  return 0;
}
