#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<vector<int> > V(n, vector<int>(m, 0));
  char c;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> c;
      if (c == '#') V[i][j] = 1;
    }
  }
  vector<vector<bool> > left(n, vector<bool>(m, 0));
  vector<vector<bool> > right(n, vector<bool>(m, 0));
  vector<vector<bool> > up(n, vector<bool>(m, 0));
  vector<vector<bool> > down(n, vector<bool>(m, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (V[i][j] == 1) {
        left[i][j] = right[i][j] = down[i][j] = up[i][j] = 0;
      } else {
        if (i == 0)
          up[i][j] = 1;
        else
          up[i][j] = up[i - 1][j];
        if (j == 0)
          left[i][j] = 1;
        else
          left[i][j] = left[i][j - 1];
        if (i == n - 1)
          down[i][j] = 1;
        else
          down[i][j] = down[i + 1][j];
        if (j == m - 1)
          right[i][j] = 1;
        else
          right[i][j] = right[i][j + 1];
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      if (V[i][j] == 1) {
        left[i][j] = right[i][j] = down[i][j] = up[i][j] = 0;
      } else {
        if (i == 0)
          up[i][j] = 1;
        else
          up[i][j] = up[i - 1][j];
        if (j == 0)
          left[i][j] = 1;
        else
          left[i][j] = left[i][j - 1];
        if (i == n - 1)
          down[i][j] = 1;
        else
          down[i][j] = down[i + 1][j];
        if (j == m - 1)
          right[i][j] = 1;
        else
          right[i][j] = right[i][j + 1];
      }
    }
  }
  vector<vector<long long> > qleft(n, vector<long long>(m, 0));
  vector<vector<long long> > qright(n, vector<long long>(m, 0));
  vector<vector<long long> > qup(n, vector<long long>(m, 0));
  vector<vector<long long> > qdown(n, vector<long long>(m, 0));
  vector<vector<long long> > sdown(n, vector<long long>(m, -1));
  vector<vector<long long> > sright(n, vector<long long>(m, -1));
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (V[i][j] == 1) {
        qleft[i][j] = qright[i][j] = qdown[i][j] = qup[i][j] = 0;
      } else {
        qleft[i][j] = qright[i][j] = qdown[i][j] = qup[i][j] =
            up[i][j] + down[i][j] + left[i][j] + right[i][j];
        if (i != 0) qup[i][j] += qup[i - 1][j];
        if (j != 0) qleft[i][j] += qleft[i][j - 1];
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      if (V[i][j] == 1) {
        qright[i][j] = qleft[i][j] = 0;
      } else {
        if (i != n - 1)
          sdown[i][j] = sdown[i + 1][j] + 1;
        else
          sdown[i][j] = 0;
        if (j != m - 1)
          sright[i][j] = sright[i][j + 1] + 1;
        else
          sright[i][j] = 0;
        qright[i][j] = (int)up[i][j] + down[i][j];
        qdown[i][j] = (int)left[i][j] + right[i][j];
        if (i != n - 1) qdown[i][j] += qdown[i + 1][j];
        if (j != m - 1) qright[i][j] += qright[i][j + 1];
      }
    }
  }
  long long tans = 0;
  for (int i = 1; i < n - 1; i++) {
    if (right[i][0]) tans++;
  }
  ans += tans;
  tans = 0;
  for (int j = 1; j < m - 1; j++)
    if (down[0][j]) tans++;
  ans += tans;
  tans = 0;
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (right[i][j] && up[i][j]) tans++;
    }
  }
  ans += tans;
  tans = 0;
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (right[i][j] && down[i][j]) tans++;
    }
  }
  ans += tans;
  tans = 0;
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (left[i][j] && down[i][j]) tans++;
    }
  }
  ans += tans;
  tans = 0;
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (left[i][j] && up[i][j]) tans++;
    }
  }
  ans += tans;
  tans = 0;
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (up[i][j] || down[i][j]) {
        int ii = i;
        int jj = j + sright[i][j];
        if (jj == m - 1) jj--;
        if (jj == j) continue;
        long long tmp = 0;
        tmp -= qright[i][jj + 1];
        tmp += qright[i][j + 1];
        tans += ((long long)up[i][j] + down[i][j]) * tmp;
        if (up[i][j] && up[i][j + 1]) tans--;
        if (down[i][j] && down[i][j + 1]) tans--;
      }
    }
  }
  ans += tans;
  tans = 0;
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (left[i][j] || right[i][j]) {
        int ii = i + sdown[i][j];
        int jj = j;
        if (ii == n - 1) ii--;
        if (ii == i) continue;
        long long tmp = 0;
        tmp -= qdown[ii + 1][j];
        tmp += qdown[i + 1][j];
        tans += ((long long)left[i][j] + right[i][j]) * tmp;
        if (left[i][j] && left[i + 1][j]) tans--;
        if (right[i][j] && right[i + 1][j]) tans--;
      }
    }
  }
  ans += tans;
  cout << ans << '\n';
  return 0;
}
