#include <bits/stdc++.h>
namespace chtholly {
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar()) f ^= c == '-';
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ '0');
  return f ? x : -x;
}
template <typename mitsuha>
inline bool read(mitsuha &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  for (; !isdigit(c) && ~c; c = getchar()) f ^= c == '-';
  if (!~c) return 0;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ '0');
  return x = f ? x : -x, 1;
}
template <typename mitsuha>
inline int write(mitsuha x) {
  if (!x) return putchar(48);
  if (x < 0) x = -x, putchar('-');
  int bit[20], i, p = 0;
  for (; x; x /= 10) bit[++p] = x % 10;
  for (i = p; i; --i) putchar(bit[i] + 48);
  return 0;
}
inline char fuhao() {
  char c = getchar();
  for (; isspace(c); c = getchar())
    ;
  return c;
}
}  // namespace chtholly
using namespace chtholly;
using namespace std;
const int _ = 415;
typedef int aoi[_][_];
char c[_][_];
int n, m, ans;
aoi zu, sh, zs, ys;
int main() {
  int i, j, k;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; ++i) scanf("%s", c[i] + 1);
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= m; ++j) {
      zu[i][j] = zu[i][j - 1] + (c[i][j] & 1);
      sh[i][j] = sh[i - 1][j] + (c[i][j] & 1);
      zs[i][j] = zs[i - 1][j - 1] + (c[i][j] & 1);
    }
    for (j = m; j; --j) ys[i][j] = ys[i - 1][j + 1] + (c[i][j] & 1);
  }
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= m; ++j) {
      if (c[i][j] & 1) continue;
      for (k = 1; k < min(i, j); ++k) {
        ans += !(c[i - k][j] & 1) && !(c[i][j - k] & 1) &&
               !(zu[i][j] - zu[i][j - k]) && !(sh[i][j] - sh[i - k][j]) &&
               !(ys[i - k][j] - ys[i][j - k]);
      }
      for (k = 1; k < min(i, m - j + 1); ++k) {
        ans += !(c[i - k][j] & 1) && !(c[i][j + k] & 1) &&
               !(sh[i][j] - sh[i - k][j]) && !(zu[i][j + k] - zu[i][j]) &&
               !(zs[i][j + k] - zs[i - k][j]);
      }
      for (k = 1; k < min(n - i + 1, j); ++k) {
        ans += !(c[i + k][j] & 1) && !(c[i][j - k] & 1) &&
               !(sh[i + k][j] - sh[i][j]) && !(zu[i][j] - zu[i][j - k]) &&
               !(zs[i + k][j] - zs[i][j - k]);
      }
      for (k = 1; k < min(n - i + 1, m - j + 1); ++k) {
        ans += !(c[i + k][j] & 1) && !(c[i][j + k] & 1) &&
               !(zu[i][j + k] - zu[i][j]) && !(sh[i + k][j] - sh[i][j]) &&
               !(ys[i + k][j] - ys[i][j + k]);
      }
      for (k = 1; k < min(i, min(j, n - i + 1)); ++k) {
        ans += !(c[i - k][j - k] & 1) && !(c[i + k][j - k] & 1) &&
               !(sh[i + k][j - k] - sh[i - k][j - k]) &&
               !(zs[i][j] - zs[i - k][j - k]) && !(ys[i][j] - ys[i + k][j - k]);
      }
      for (k = 1; k < min(j, min(i, m - j + 1)); ++k) {
        ans += !(c[i - k][j - k] & 1) && !(c[i - k][j + k] & 1) &&
               !(zu[i - k][j + k] - zu[i - k][j - k]) &&
               !(ys[i][j] - ys[i - k][j + k]) && !(zs[i][j] - zs[i - k][j - k]);
      }
      for (k = 1; k < min(n - i + 1, min(j, m - j + 1)); ++k) {
        ans += !(c[i + k][j - k] & 1) && !(c[i + k][j + k] & 1) &&
               !(zu[i + k][j - k] - zu[i + k][j + k]) &&
               !(ys[i][j] - ys[i + k][j - k]) && !(zs[i][j] - zs[i + k][j + k]);
      }
      for (k = 1; k < min(m - j + 1, min(i, n - i + 1)); ++k) {
        ans += !(c[i - k][j + k] & 1) && !(c[i + k][j + k] & 1) &&
               !(sh[i + k][j + k] - sh[i - k][j + k]) &&
               !(ys[i][j] - ys[i - k][j + k]) && !(zs[i][j] - zs[i + k][j + k]);
      }
    }
  }
  write(ans);
}
