#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int n, m;
char s[N][N];
int L[N], R[N], U[N], D[N];
long long ans;
void init() {
  for (int i = (int)(1); i <= (int)(n); i++)
    for (L[i] = 1; L[i] <= m && s[i][L[i]] == '.'; ++L[i])
      ;
  for (int i = (int)(1); i <= (int)(n); i++)
    for (R[i] = m; R[i] >= 1 && s[i][R[i]] == '.'; --R[i])
      ;
  for (int i = (int)(1); i <= (int)(m); i++)
    for (U[i] = 1; U[i] <= n && s[U[i]][i] == '.'; ++U[i])
      ;
  for (int i = (int)(1); i <= (int)(m); i++)
    for (D[i] = n; D[i] >= 1 && s[D[i]][i] == '.'; --D[i])
      ;
}
void solve1() {
  for (int i = (int)(2); i <= (int)(n - 1); i++)
    for (int j = (int)(2); j <= (int)(m - 1); j++)
      ans += ((L[i] > j) + (R[i] < j)) * ((U[j] > i) + (D[j] < i));
}
void solve2() {
  for (int i = (int)(2); i <= (int)(n - 1); i++) ans += (L[i] > m);
  for (int i = (int)(2); i <= (int)(m - 1); i++) ans += (U[i] > n);
  for (int i = (int)(2); i <= (int)(n - 1); i++) {
    int S = 0;
    for (int j = (int)(2); j <= (int)(m - 1); j++)
      if (s[i][j] == '#')
        S = 0;
      else {
        int SS = (U[j] > i) + (D[j] < i);
        if (j > 2 && U[j] > i && U[j - 1] > i) ans--;
        if (j > 2 && D[j] < i && D[j - 1] < i) ans--;
        ans += SS * S;
        S += SS;
      }
  }
  for (int i = (int)(2); i <= (int)(m - 1); i++) {
    int S = 0;
    for (int j = (int)(2); j <= (int)(n - 1); j++)
      if (s[j][i] == '#')
        S = 0;
      else {
        int SS = (L[j] > i) + (R[j] < i);
        if (j > 2 && L[j] > i && L[j - 1] > i) ans--;
        if (j > 2 && R[j] < i && R[j - 1] < i) ans--;
        ans += SS * S;
        S += SS;
      }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(n); i++) scanf("%s", s[i] + 1);
  init();
  solve1();
  solve2();
  printf("%lld\n", ans);
}
