#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template <class T = int>
using V = vector<T>;
template <class T = int>
using VV = V<V<T> >;
template <class T>
void assign(V<T>& v, int n, const T& a = T()) {
  v.assign(n, a);
}
template <class T, class... Args>
void assign(V<T>& v, int n, const Args&... args) {
  v.resize(n);
  for (auto&& e : v) assign(e, args...);
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  V<string> s(h);
  for (int i = 0; i < h; ++i) cin >> s[i];
  lint res = 0;
  VV<> ca;
  assign(ca, h + w, h + 1);
  for (int k = 0; k < h + w - 1; ++k)
    for (int x = 0; x < h; ++x) {
      int y = k - x;
      if (y < 0 or y >= w) continue;
      ca[k][x + 1] = ca[k][x] + (s[x][y] == '#');
    }
  VV<> cb;
  assign(cb, h + w, h + 1);
  for (int k = 0; k < h + w - 1; ++k)
    for (int x = 0; x < h; ++x) {
      int y = w - 1 - (k - x);
      if (y < 0 or y >= w) continue;
      cb[k][x + 1] = cb[k][x] + (s[x][y] == '#');
    }
  for (int k = 0; k < h + w - 1; ++k) {
    for (int xl = 0; xl < h; ++xl)
      for (int xr = xl + 1; xr < h; ++xr)
        if ((xr - xl) % 3 == 0) {
          if (k - xr + xl >= 0)
            res +=
                ca[k - xr + xl][xr + xr - xl] - ca[k - xr + xl][xl + xr - xl];
        }
  }
  for (int k = 0; k < h + w - 1; ++k) {
    for (int xl = 0; xl < h; ++xl)
      for (int xr = xl + 1; xr < h; ++xr)
        if ((xr - xl) % 3 == 0) {
          if (k - xr + xl >= 0)
            res +=
                cb[k - xr + xl][xr + xr - xl] - cb[k - xr + xl][xl + xr - xl];
        }
  }
  cout << res << '\n';
}
