#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
template <typename V>
void rotate_left_square(V &a, int n) {
  int n1 = n / 2, n2 = n - n1;
  for (int(j) = 0; (j) < (int)(n1); ++(j))
    for (int(i) = 0; (i) < (int)(n2); ++(i)) {
      auto t = a[i][n - 1 - j];
      a[i][n - 1 - j] = a[n - 1 - j][n - 1 - i];
      a[n - 1 - j][n - 1 - i] = a[n - 1 - i][j];
      a[n - 1 - i][j] = a[j][i];
      a[j][i] = t;
    }
}
template <typename V>
void rotate_left(V &a, int H, int W) {
  rotate_left_square(a, max(H, W));
  int pad = max(0, H - W);
  if (pad > 0) {
    for (int i = 0; i < W; i++)
      for (int j = 0; j < H; ++j) a[i][j] = a[i + pad][j];
  }
}
template <typename T>
struct RectangeSum {
  vector<vector<T> > sum;
  template <typename U>
  void init(int h, int w, U &a) {
    sum.assign(h + 1, vector<T>(w + 1));
    for (int(y) = (int)(0); (y) <= (int)(h); ++(y))
      for (int(x) = (int)(0); (x) <= (int)(w); ++(x))
        sum[y][x] = (y == 0 || x == 0)
                        ? 0
                        : sum[y - 1][x] + sum[y][x - 1] - sum[y - 1][x - 1] +
                              a[y - 1][x - 1];
  }
  inline T get(int t, int l, int b, int r) const {
    return sum[b][r] - sum[b][l] - sum[t][r] + sum[t][l];
  }
};
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<char *> s(max(n, m) + 1);
  for (int(i) = 0; (i) < (int)(max(n, m) + 1); ++(i))
    s[i] = new char[max(n, m) + 1];
  for (int(i) = 0; (i) < (int)(n); ++(i)) scanf("%s", s[i]);
  long long straight = 0, turnonce = 0, zigzagR = 0, zigzagL = 0, uturn = 0;
  RectangeSum<int> rsum;
  for (int(rot) = 0; (rot) < (int)(4); ++(rot)) {
    vector<vector<bool> > b(n, vector<bool>(m));
    for (int(i) = 0; (i) < (int)(n); ++(i))
      for (int(j) = 0; (j) < (int)(m); ++(j)) b[i][j] = s[i][j] == '#';
    rsum.init(n, m, b);
    for (int(j) = (int)(1); (j) < (int)(m - 1); ++(j)) {
      bool ok = true;
      for (int(i) = 0; (i) < (int)(n); ++(i)) ok &= s[i][j] == '.';
      straight += ok;
    }
    for (int(j) = (int)(1); (j) < (int)(m - 1); ++(j))
      for (int(i) = (int)(1); (i) < (int)(n - 1); ++(i)) {
        bool ok = true;
        ok &= rsum.get(0, j, i + 1, j + 1) == 0;
        ok &= rsum.get(i, j, i + 1, m) == 0;
        turnonce += ok;
      }
    for (int(i) = (int)(1); (i) < (int)(n - 1); ++(i)) {
      int cnt = 0;
      for (int(j) = (int)(1); (j) < (int)(m - 1); ++(j)) {
        if (s[i][j] == '#') {
          cnt = 0;
          continue;
        }
        if (rsum.get(i, j, n, j + 1) == 0) zigzagR += cnt;
        if (rsum.get(0, j, i + 1, j + 1) == 0) ++cnt;
      }
      cnt = 0;
      for (int j = m - 2; j >= 1; --j) {
        if (s[i][j] == '#') {
          cnt = 0;
          continue;
        }
        if (rsum.get(i, j, n, j + 1) == 0) zigzagL += cnt;
        if (rsum.get(0, j, i + 1, j + 1) == 0) ++cnt;
      }
    }
    for (int(i) = (int)(1); (i) < (int)(n - 1); ++(i)) {
      int cnt = 0;
      bool prevok = false;
      for (int(j) = (int)(1); (j) < (int)(m - 1); ++(j)) {
        if (s[i][j] == '#') {
          cnt = 0, prevok = false;
          continue;
        }
        bool ok = rsum.get(0, j, i + 1, j + 1) == 0;
        if (ok) uturn += cnt;
        cnt += prevok;
        prevok = ok;
      }
    }
    rotate_left(s, n, m);
    swap(n, m);
  }
  long long ans = straight / 2 + turnonce + zigzagR / 2 + zigzagL / 2 + uturn;
  cout << ans << endl;
  return 0;
}
