#include <bits/stdc++.h>
using namespace std;
int r, c;
char M[2015][2015];
int L[2015], R[2015], U[2015], D[2015];
int main() {
  scanf("%d%d", &r, &c);
  for (int i = 0; i < r; i++) {
    scanf("%s", &M[i]);
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c && M[i][j] == '.'; j++) {
      L[i]++;
    }
    for (int j = c - 1; j >= 0 && M[i][j] == '.'; j--) {
      R[i]++;
    }
  }
  for (int j = 0; j < c; j++) {
    for (int i = 0; i < r && M[i][j] == '.'; i++) {
      U[j]++;
    }
    for (int i = r - 1; i >= 0 && M[i][j] == '.'; i--) {
      D[j]++;
    }
  }
  long long ans = 0;
  for (int i = r - 2; i > 0; i--) {
    for (int j = c - 2; j > 0; j--) {
      ans += ((L[i] > j) && (U[j] > i));
      ans += ((L[i] > j) && (D[j] >= r - i));
      ans += ((R[i] >= c - j) && (U[j] > i));
      ans += ((R[i] >= c - j) && (D[j] >= r - i));
    }
  }
  for (int i = r - 2; i > 0; i--) {
    for (int j = c - 2, k; j > 0; j--) {
      k = j;
      int a = 0, b = 0;
      while (k > 0 && M[i][k] == '.') {
        a += (U[k] > i);
        b += (D[k] >= r - i);
        k--;
      }
      j = k;
      ans += (a * (a - 1)) / 2 + (b * (b - 1)) / 2 + a * b;
    }
  }
  for (int j = c - 2; j > 0; j--) {
    for (int i = r - 2, k; i > 0; i--) {
      k = i;
      int a = 0, b = 0;
      while (k > 0 && M[k][j] == '.') {
        a += (L[k] > j);
        b += (R[k] >= c - j);
        k--;
      }
      i = k;
      ans += (a * (a - 1)) / 2 + (b * (b - 1)) / 2 + a * b;
    }
  }
  for (int i = r - 2; i > 0; i--) {
    if (L[i] == c) ans -= c - 3;
    for (int j = c - 3; j > 0; j--) {
      ans -= ((U[j] > i) && (U[j + 1] > i));
      ans -= ((D[j] >= r - i) && (D[j + 1] >= r - i));
    }
  }
  for (int j = c - 2; j > 0; j--) {
    if (U[j] == r) ans -= r - 3;
    for (int i = r - 3; i > 0; i--) {
      ans -= ((L[i] > j) && (L[i + 1] > j));
      ans -= ((R[i] >= c - j) && (R[i + 1] >= c - j));
    }
  }
  cout << ans << endl;
}
