#include <iostream>
#include <string>
#include <vector>

int main(int argc, char *argv[]) {
  int h, w;
  std::cin >> h >> w;

  std::vector<std::string> ss(h);
  for (int i = 0; i < h; ++i) {
    std::cin >> ss[i];
  }

  int count = 0;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (ss[i].at(j) == '#') {
        continue;
      }

      if (j + 1 < w && ss[i].at(j + 1) != '#') {
        ++count;
      }

      if (i + 1 < h && ss[i + 1].at(j) != '#') {
        ++count;
      }
    }
  }

  std::cout << count << std::endl;

  return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 128
char s[N][N];

int main(){
	int h, w; scanf("%d%d", &h, &w);
	REP(i, h) scanf("%s", s[i]);
	int ans = 0;
	REP(k, 2){
		REP(i, h) REP(j, w-1) if(s[i][j] == '.' && s[i][j+1]=='.') ans++;
		REP(i, N) REP(j, i) swap(s[i][j], s[j][i]);
		swap(h, w);
	}
	printf("%d\n", ans);
}
