#include <bits/stdc++.h>
using namespace std;
char grid[2015][2015];
bool a[2015][2015][4];
int n, m;
long long ans = 0;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%s", grid[i] + 1);
  }
  for (int i = 1; i <= n; i++) {
    bool all = true;
    int p = m;
    for (int j = 1; j <= m; j++) {
      if (grid[i][j] == '#') {
        all = false;
        p = j - 1;
        break;
      }
    }
    for (int j = p; j >= 1; j--) {
      a[i][j][1] = 1;
    }
    all = true;
    p = 1;
    for (int j = m; j >= 1; j--) {
      if (grid[i][j] == '#') {
        all = false;
        p = j + 1;
        break;
      }
    }
    for (int j = p; j <= m; j++) {
      a[i][j][3] = 1;
    }
    if (all && i != 1 && i != n) ans += 1;
  }
  for (int j = 1; j <= m; j++) {
    bool all = true;
    int p = n;
    for (int i = 1; i <= n; i++) {
      if (grid[i][j] == '#') {
        all = false;
        p = i - 1;
        break;
      }
    }
    for (int i = p; i >= 1; i--) {
      a[i][j][0] = 1;
    }
    all = true;
    p = 1;
    for (int i = n; i >= 1; i--) {
      if (grid[i][j] == '#') {
        all = false;
        p = i + 1;
        break;
      }
    }
    for (int i = p; i <= n; i++) {
      a[i][j][2] = 1;
    }
    if (all && j != 1 && j != m) ans += 1;
  }
  for (int i = 2; i < n; i++) {
    for (int j = 2; j < m; j++) {
      if (a[i][j][0] && a[i][j][1]) ans += 1;
      if (a[i][j][0] && a[i][j][3]) ans += 1;
      if (a[i][j][1] && a[i][j][2]) ans += 1;
      if (a[i][j][2] && a[i][j][3]) ans += 1;
    }
  }
  long long last2 = 0, last1 = 0;
  for (int i = 2; i < n; i++) {
    last2 = last1 = 0;
    for (int j = 2; j < m; j++) {
      if (a[i][j][2]) ans += last1;
      if (a[i][j][0]) ans += last2;
      last2 = last1;
      last1 += a[i][j][0];
      if (grid[i][j] == '#') last2 = last1 = 0;
    }
  }
  last2 = last1 = 0;
  for (int j = 2; j < m; j++) {
    last2 = last1 = 0;
    for (int i = n - 1; i > 1; i--) {
      if (a[i][j][3]) ans += last2;
      if (a[i][j][1]) ans += last1;
      last2 = last1;
      last1 += a[i][j][3];
      if (grid[i][j] == '#') last2 = last1 = 0;
    }
  }
  last2 = last1 = 0;
  for (int j = 2; j < m; j++) {
    last2 = last1 = 0;
    for (int i = n - 1; i > 1; i--) {
      if (a[i][j][1]) ans += last2;
      if (a[i][j][3]) ans += last1;
      last2 = last1;
      last1 += a[i][j][1];
      if (grid[i][j] == '#') last2 = last1 = 0;
    }
  }
  last2 = last1 = 0;
  for (int i = 2; i < n; i++) {
    last2 = last1 = 0;
    for (int j = 2; j < m; j++) {
      if (a[i][j][2]) ans += last2;
      if (a[i][j][0]) ans += last1;
      last2 = last1;
      last1 += a[i][j][2];
      if (grid[i][j] == '#') last2 = last1 = 0;
    }
  }
  printf("%lld\n", ans);
}
