#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005;
int a[MAXN][MAXN], par[MAXN][MAXN], b[MAXN][MAXN];
long long ans;
int n, m;
bool empty(int i, int j, int t) {
  if ((t == 0 && par[i][j] == 0) ||
      (t == 1 && par[n - 1][j] - (i == 0 ? 0 : par[i - 1][j]) == 0))
    return true;
  return false;
}
void solve() {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      par[i][j] = (i == 0 ? 0 : par[i - 1][j]) + a[i][j];
  for (int i = 1; i < n - 1; i++)
    for (int j = 1; j < m - 1; j++) {
      int sum = 0;
      int k = j;
      while (k < m - 1 && a[i][k] == 0) {
        sum += empty(i, k, 0) + empty(i, k, 1);
        k++;
      }
      for (int l = j; l < k; l++) {
        if (empty(i, l, 0))
          ans += sum - (l + 1 == k ? 0 : empty(i, l + 1, 0)) - empty(i, l, 0) -
                 empty(i, l, 1);
        sum -= empty(i, l, 0);
      }
      j = k;
    }
  for (int i = 1; i < n - 1; i++)
    for (int j = 1; j < m - 1; j++) {
      int sum = 0, k = j;
      while (k < m - 1 && a[i][k] == 0) {
        sum += empty(i, k, 1);
        k++;
      }
      for (int l = j; l < k; l++) {
        if (empty(i, l, 1))
          ans += sum - (l + 1 == k ? 0 : empty(i, l + 1, 1)) - empty(i, l, 1);
        sum -= empty(i, l, 1);
      }
      j = k;
    }
  for (int j = 1; j < m - 1; j++)
    if (par[n - 1][j] == 0) ans++;
}
void solve2() {
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (a[i][j] || a[i][0]) break;
      if (empty(i, j, 0)) ans++;
      if (empty(i, j, 1)) ans++;
    }
    for (int j = m - 2; j > 0; j--) {
      if (a[i][j] || a[i][m - 1]) break;
      if (empty(i, j, 0)) ans++;
      if (empty(i, j, 1)) ans++;
    }
  }
}
void rotate() {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) b[j][n - i - 1] = a[i][j];
  swap(n, m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) a[i][j] = b[i][j];
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++)
      if (s[j] == '#') a[i][j] = 1;
  }
  solve();
  solve2();
  rotate();
  solve();
  cout << ans << endl;
  return 0;
}
