#include <bits/stdc++.h>
// #include <atcoder/all>

#define int long long

struct edge {
    int to;
    int cost;
};

using namespace std;
// using namespace atcoder;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vb = vector<bool>;
using qi = queue<int>;
using P = pair<int, int>;
using graph = vector<vector<edge>>;
// using graph = vector<vector<int>>;
// using mint = modint1000000007;


#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define delim(i, n) cout << (i == n-1 ? "\n" : " ")
#define print1(v) cout << fixed << setprecision(10) << v << "\n"
#define print2(v1, v2) cout << fixed << setprecision(10) << v1 << " " << v2 << "\n"
#define print3(v1, v2, v3) cout << fixed << setprecision(10) << v1 << " " << v2 << " " << v3 << "\n"
#define printvi(v, n) REP(iiii, n) { cout << v[iiii]; delim(iiii, n); }
#define printvii(v, h, w) REP(iiiii, h) { printvi(v[iiiii], w); }

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int inf = 1LL << 60;
// const int inf = 100000000;
const int mod = 1000000007;

const int maxn = 5000+5;
int h, w;

vi dx = {-1, 0, 0, 1};
vi dy = {0, -1, 1, 0};

signed main () {
	cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> h >> w;

    vector<string> s(h);
    REP(i, h) {
        cin >> s[i];
    }

    int cnt = 0;
    REP(i, h) {
        REP(j, w) {
            if (s[i][j] == '.') {
                if (i > 0) {
                    if (s[i-1][j] == '.') {
                        cnt++;
                    }
                }
                if (j > 0) {
                    if (s[i][j-1] == '.') {
                        cnt++;
                    }
                }
            }
        }
    }

    print1(cnt);
}
#include <bits/stdc++.h>
using namespace std;

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