#include <bits/stdc++.h>
using namespace std;
char second[2011][2011];
int sh[2011][2011];
int shr[2011][2011];
int svr[2011][2011];
int sv[2011][2011];
int col[2011] = {0};
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> second[i + 1][j + 1];
  long long int ans1 = 0;
  long long int ans2 = 0;
  long long int ans3 = 0;
  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j < m + 1; j++) {
      if (second[i][j] == '.') {
        sh[i][j] = sh[i][j - 1] + 1;
        sv[i][j] = sv[i - 1][j] + 1;
      } else {
        sh[i][j] = sh[i][j - 1];
        sv[i][j] = sv[i - 1][j];
      }
    }
    for (int j = m; j >= 1; j--) {
      if (second[i][j] == '.') {
        shr[i][j] = shr[i][j + 1] + 1;
      } else {
        shr[i][j] = shr[i][j + 1];
      }
    }
    if (i > 1 and i < n) {
      if (shr[i][1] == m) ans1++;
    }
    if (i == n) {
      for (int j = 2; j < m; j++)
        if (sv[i][j] == n) ans1++;
    }
  }
  for (int i = n; i > 0; i--) {
    for (int j = 1; j <= m; j++) {
      if (second[i][j] == '.') {
        svr[i][j] = svr[i + 1][j] + 1;
      } else {
        svr[i][j] = svr[i + 1][j];
      }
    }
  }
  for (int i = 2; i < n; i++) {
    for (int j = 2; j < m; j++) {
      if (sh[i][j] == j and sv[i][j] == i) ans2++;
      if (sh[i][j] == j and svr[i][j] == n - i + 1) ans2++;
      if (shr[i][j] == m - j + 1 and sv[i][j] == i) ans2++;
      if (shr[i][j] == m - j + 1 and svr[i][j] == n - i + 1) ans2++;
    }
  }
  for (int i = 2; i < n; i++) {
    int last = 1;
    for (int j = 2; j < m; j++) {
      col[j] = 0;
      if (second[i][j] == '#') {
        last = j;
        continue;
      }
      if (second[i][j] == '.') {
        if (sv[i][j] == i) col[j]++;
        if (svr[i][j] == n - i + 1) col[j]++;
      }
      col[j] += col[j - 1];
      if (j > 2 and second[i][j] == '.' and second[i][j - 1] == '.') {
        if (sv[i][j] == i and svr[i][j - 1] == n - i + 1) ans3++;
        if (svr[i][j] == n - i + 1 and sv[i][j - 1] == i) ans3++;
      }
      if (j - 2 > last) {
        if (sv[i][j] == i) ans3 += col[j - 2];
        if (svr[i][j] == n - i + 1) ans3 += col[j - 2];
      }
    }
  }
  for (int j = 2; j < m; j++) {
    int last = 1;
    for (int i = 2; i < n; i++) {
      col[i] = 0;
      if (second[i][j] == '#') {
        last = i;
        continue;
      }
      col[i] = col[i - 1];
      if (i - 1 > 1 and second[i][j] == '.' and second[i - 1][j] == '.') {
        if (sh[i][j] == j and shr[i - 1][j] == m - j + 1) ans3++;
        if (shr[i][j] == m - j + 1 and sh[i - 1][j] == j) ans3++;
      }
      if (shr[i][j] == m - j + 1) col[i]++;
      if (sh[i][j] == j) col[i]++;
      if (i - 2 > last) {
        if (shr[i][j] == m - j + 1) ans3 += col[i - 2];
        if (sh[i][j] == j) ans3 += col[i - 2];
      }
    }
  }
  cout << ans3 + ans2 + ans1;
}
