#include <bits/stdc++.h>
using namespace std;
string S[2000 + 5];
int get(vector<vector<int> > &T, int lox, int hix, int loy, int hiy) {
  return T[hix + 1][hiy + 1] - T[hix + 1][loy] - T[lox][hiy + 1] + T[lox][loy];
}
vector<int> impr(vector<int> &v) {
  for (int i = 0; i < ((int)(v).size()); ++i) cout << v[i] << " ";
  cout << endl;
}
vector<int> get(vector<int> &v) {
  vector<int> AC(v);
  for (int i = ((int)(v).size()) - 2; i >= 0; --i) AC[i] = AC[i + 1] + v[i];
  return AC;
}
long long solve(vector<int> &v, vector<int> &w) {
  vector<int> Sv = get(v), Sw = get(w);
  long long ans = 0;
  for (int i = 0; i < ((int)(v).size()); ++i) {
    if (i + 2 < ((int)(v).size())) ans += v[i] * Sv[i + 2];
    if (i + 1 < ((int)(v).size())) ans += v[i] * Sw[i + 1];
    if (i + 2 < ((int)(v).size())) ans += w[i] * Sw[i + 2];
    if (i + 1 < ((int)(v).size())) ans += w[i] * Sv[i + 1];
  }
  return ans;
}
int main() {
  int n, m;
  while (cin >> n >> m) {
    for (int i = 0; i < n; ++i) cin >> S[i];
    vector<vector<int> > T(n + 1, vector<int>(m + 1));
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j)
        T[i + 1][j + 1] =
            T[i + 1][j] + T[i][j + 1] - T[i][j] + (S[i][j] == '#');
    long long ans = 0;
    for (int i = 1; i < n - 1; ++i) ans += (get(T, i, i, 0, m - 1) == 0);
    for (int j = 1; j < m - 1; ++j) ans += (get(T, 0, n - 1, j, j) == 0);
    for (int i = 1; i < n - 1; ++i)
      for (int j = 1; j < m - 1; ++j) {
        int p = 0, q = 0;
        p += (get(T, i, i, 0, j) == 0);
        p += (get(T, i, i, j, m - 1) == 0);
        q += (get(T, 0, i, j, j) == 0);
        q += (get(T, i, n - 1, j, j) == 0);
        ans += p * q;
      }
    for (int i = 1; i < n - 1; ++i) {
      for (int j = 1; j < m - 1; ++j) {
        if (S[i][j] == '#') continue;
        int ind;
        for (int k = j; k < m - 1; ++k)
          if (S[i][k] == S[i][j])
            ind = k;
          else
            break;
        vector<int> v, w;
        for (int k = j; k <= ind; ++k) {
          v.push_back((get(T, 0, i, k, k) == 0));
          w.push_back((get(T, i, n - 1, k, k) == 0));
        }
        ans += solve(v, w);
        j = ind;
      }
    }
    for (int j = 1; j < m - 1; ++j) {
      for (int i = 1; i < n - 1; ++i) {
        if (S[i][j] == '#') continue;
        int ind;
        for (int k = i; k < n - 1; ++k)
          if (S[k][j] == S[i][j])
            ind = k;
          else
            break;
        vector<int> v, w;
        for (int k = i; k <= ind; ++k) {
          v.push_back((get(T, k, k, 0, j) == 0));
          w.push_back((get(T, k, k, j, m - 1) == 0));
        }
        ans += solve(v, w);
        i = ind;
      }
    }
    cout << ans << '\n';
  }
}
