#include <bits/stdc++.h>
using namespace std;
const int maxsz = 2010;
char row[maxsz];
int h[maxsz][maxsz];
int v[maxsz][maxsz];
int n, m, up, dn, lt, rt;
long long int cnt0, cnt1, cnt2, ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < (n); ++i) {
    cin >> row;
    for (int j = 0; j < (m); ++j) {
      if (row[j] == '.') {
        v[i][j] = (i > 0) ? (v[i - 1][j] + 1) : 1;
        h[i][j] = (j > 0) ? (h[i][j - 1] + 1) : 1;
      } else {
        h[i][j] = 0;
        v[i][j] = 0;
      }
    }
  }
  cnt0 = cnt1 = cnt2 = 0;
  for (int i = (1); i < (n - 1); ++i)
    if (h[i][m - 1] == m) cnt0++;
  for (int j = (1); j < (m - 1); ++j)
    if (v[n - 1][j] == n) cnt0++;
  for (int i = (1); i < (n - 1); ++i) {
    int uc = 0, dc = 0;
    int u1 = 0, d1 = 0;
    for (int j = (1); j < (m - 1); ++j) {
      up = (v[i][j] == i + 1) ? 1 : 0;
      dn = (v[n - 1][j] >= n - i) ? 1 : 0;
      lt = (h[i][j] == j + 1) ? 1 : 0;
      rt = (h[i][m - 1] >= m - j) ? 1 : 0;
      cnt1 += (up + dn) * (lt + rt);
      uc += up;
      dc += dn;
      cnt2 -= up * u1 + d1 * dn + up * dn;
      u1 = up;
      d1 = dn;
      if (h[i][j] == 0) {
        cnt2 += (uc * (uc - 1)) / 2 + (dc * (dc - 1)) / 2 + uc * dc;
        uc = dc = 0;
      }
    }
    cnt2 += (uc * (uc - 1)) / 2 + (dc * (dc - 1)) / 2 + uc * dc;
  }
  for (int j = (1); j < (m - 1); ++j) {
    int lc = 0, rc = 0;
    int l1 = 0, r1 = 0;
    for (int i = (1); i < (n - 1); ++i) {
      lt = (h[i][j] == j + 1) ? 1 : 0;
      rt = (h[i][m - 1] >= m - j) ? 1 : 0;
      lc += lt;
      rc += rt;
      cnt2 -= lt * l1 + r1 * rt + lt * rt;
      r1 = rt;
      l1 = lt;
      if (v[i][j] == 0) {
        cnt2 += (lc * (lc - 1)) / 2 + (rc * (rc - 1)) / 2 + lc * rc;
        lc = rc = 0;
      }
    }
    cnt2 += (lc * (lc - 1)) / 2 + (rc * (rc - 1)) / 2 + lc * rc;
  }
  ans = cnt0 + cnt1 + cnt2;
  cout << ans << "\n";
}
