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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    for (int i = 0;i < h;++i) cin >> s[i];
    int ans = 0;
    for (int i = 0;i < h;++i) for (int j = 0;j < w-1;++j) if (s[i][j] == '.' && s[i][j+1] == '.') ans++;
    for (int i = 0;i < h-1;++i) for (int j = 0;j < w;++j) if (s[i][j] == '.' && s[i+1][j] == '.') ans++;
    cout << ans << newl;
}
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define P pair<int,int>
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int MOD = 1e9+7;
template<class T> inline bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int h,w; cin >> h >> w;
  vector<string> s(h); rep(i,h) cin >> s[i];
  ll ans = 0;
  rep(i,h){
    rep(j,w){
      rep(k,4){
        if(j+dx[k]<0 || w<=j+dx[k] || i+dy[k]<0 || h<=i+dy[k]) continue;
        if(s[i][j] == '.' && s[i+dy[k]][j+dx[k]] == '.') ans++;
      }
    }
  }
  cout << ans/2;
  cout << endl;
  return 0;
}
