#include <bits/stdc++.h>
using namespace std;
char s[2001][2001];
int top[2001], bot[2001], huj[2001], fag[2001];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", s[i]);
  }
  s[0][0] = s[0][m - 1] = s[n - 1][0] = s[n - 1][m - 1] = '#';
  for (int i = 0; i < n; i++) {
    while (huj[i] < m && s[i][huj[i]] == '.') huj[i]++;
    fag[i] = m - 1;
    while (fag[i] >= 0 && s[i][fag[i]] == '.') fag[i]--;
  }
  for (int j = 0; j < m; j++) {
    while (top[j] < n && s[top[j]][j] == '.') top[j]++;
    bot[j] = n - 1;
    while (bot[j] >= 0 && s[bot[j]][j] == '.') bot[j]--;
  }
  long long ans = 0;
  for (int i = 1; i < n - 1; i++) {
    if (huj[i] == m) ans++;
  }
  for (int j = 1; j < m - 1; j++) {
    if (top[j] == n) ans++;
  }
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (huj[i] > j && top[j] > i) ans++;
      if (huj[i] > j && bot[j] < i) ans++;
      if (fag[i] < j && top[j] > i) ans++;
      if (fag[i] < j && bot[j] < i) ans++;
    }
  }
  for (int j = 1; j < m - 1; j++) {
    for (int k = 1; k < n - 1;) {
      int i = k;
      while (i < n - 1 && s[i][j] == '.') i++;
      int lc = 0, rc = 0, x = 0;
      int a = 0, b = 0;
      for (int t = k; t < i; t++) {
        if (huj[t] > j) lc++;
        if (fag[t] < j) rc++;
        if (huj[t] > j && fag[t] < j) x++;
        if (t + 1 < i) {
          if (huj[t] > j && huj[t + 1] > j) ans--;
          if (fag[t] < j && fag[t + 1] < j) ans--;
        }
      }
      ans += (long long)lc * rc - x + lc * (lc - 1) / 2 + rc * (rc - 1) / 2;
      if (k == i) i++;
      k = i;
    }
  }
  for (int i = 1; i < n - 1; i++) {
    for (int k = 1; k < m - 1;) {
      int j = k;
      while (j < m - 1 && s[i][j] == '.') j++;
      int lc = 0, rc = 0, x = 0;
      int a = 0, b = 0;
      for (int t = k; t < j; t++) {
        if (top[t] > i) lc++;
        if (bot[t] < i) rc++;
        if (top[t] > i && bot[t] < i) x++;
        if (t + 1 < j) {
          if (top[t] > i && top[t + 1] > i) ans--;
          if (bot[t] < i && bot[t + 1] < i) ans--;
        }
      }
      ans += (long long)lc * rc - x + lc * (lc - 1) / 2 + rc * (rc - 1) / 2;
      if (k == j) j++;
      k = j;
    }
  }
  cout << ans;
}
