#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int n, m;
char s[N];
bool a[N][N], b[N][N], d[N][N], u[N][N];
long long ans = 0;
void solve(bool t[][N], int nn, int mm, int flag) {
  memset(d, false, sizeof(d));
  memset(u, false, sizeof(u));
  for (int i = 1; i <= nn; i++)
    for (int j = 1; j <= mm; j++) d[i][j] = d[i - 1][j] | t[i][j];
  for (int i = nn; i > 0; i--)
    for (int j = 1; j <= mm; j++) u[i][j] = u[i + 1][j] | t[i][j];
  for (int i = 2; i < nn; i++) {
    int tmp = 0;
    if (!t[i][1] && flag) tmp = 1;
    d[i][1] = u[i][1] = 1;
    for (int j = 2; j < mm; j++) {
      if (t[i][j]) {
        tmp = 0;
        continue;
      }
      ans += ((!d[i][j]) + (!u[i][j])) * tmp;
      ans += (!d[i][j] && !u[i][j - 1]) + (!u[i][j] && !d[i][j - 1]);
      tmp += (!d[i][j - 1]) + (!u[i][j - 1]);
    }
    if (!t[i][mm] && flag) ans += tmp + (!d[i][mm - 1]) + (!u[i][mm - 1]);
  }
  if (flag) {
    for (int j = 2; j < mm; j++) ans += (!d[nn][j]);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    for (int j = 1; j <= m; j++) a[i][j] = s[j] == '#';
  }
  solve(a, n, m, 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) b[j][i] = a[i][j];
  solve(b, m, n, 0);
  printf("%I64d\n", ans);
  return 0;
}
