#include <bits/stdc++.h>
using namespace std;
const long long MAXN = (1LL << 20) + 10;
void fi(const char* tem) {
  if (!strlen(tem)) return;
  char A[50];
  const char B[4] = {'.', 'i', 'n', 0}, C[5] = {'.', 'o', 'u', 't', 0};
  memset(A, 0, sizeof(A));
  sprintf(A, "%s%s", tem, B);
  freopen(A, "r", stdin);
  sprintf(A, "%s%s", tem, C);
  freopen(A, "w", stdout);
  return;
}
long long N, M, ans;
char ss[MAXN];
long long g[2010][2010], p[2010][2010], u[2010][2010], d[2010][2010];
long long solve(long long f[][2010], long long n, long long m, long long flag);
int main() {
  fi("");
  scanf("%lld%lld", &N, &M);
  for (long long i = 1; i <= N; i++) {
    scanf("%s", ss + 1);
    for (long long j = 1; j <= M; j++) g[i][j] = ss[j] == '#';
  }
  solve(g, N, M, 1LL);
  for (long long i = 1; i <= N; i++)
    for (long long j = 1; j <= M; j++) p[j][i] = g[i][j];
  swap(p, g);
  solve(g, M, N, 0LL);
  printf("%lld\n", ans);
  return 0;
}
long long solve(long long f[][2010], long long n, long long m, long long flag) {
  memset(u, 0, sizeof(u));
  memset(d, 0, sizeof(d));
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) d[i][j] = d[i - 1][j] | f[i][j];
  for (long long i = n; i; i--)
    for (long long j = m; j; j--) u[i][j] = u[i + 1][j] | f[i][j];
  for (long long i = 2; i < n; i++) {
    long long tem = 0;
    if (!f[i][1] && flag) tem = 1;
    d[i][1] = u[i][1] = 1;
    for (long long j = 2; j < m; j++) {
      if (f[i][j]) {
        tem = 0;
        continue;
      }
      ans += ((!d[i][j]) + (!u[i][j])) * tem;
      ans += ((!d[i][j]) & (!u[i][j - 1])) + ((!d[i][j - 1]) & (!u[i][j]));
      tem += (!u[i][j - 1]) + (!d[i][j - 1]);
    }
    if (!f[i][m] && flag) ans += tem + (!d[i][m - 1]) + (!u[i][m - 1]);
  }
  if (flag)
    for (long long j = 2; j < m; j++) ans += (!d[n][j]);
  return 0;
}
