#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
namespace io {
const int L = (1 << 20) + 1;
char buf[L], *S, *T, c;
char getchar() {
  if (__builtin_expect(S == T, 0)) {
    T = (S = buf) + fread(buf, 1, L, stdin);
    return (S == T ? EOF : *S++);
  }
  return *S++;
}
int inp() {
  int x = 0, f = 1;
  char ch;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  return x * f;
}
unsigned inpu() {
  unsigned x = 0;
  char ch;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    ;
  for (; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  return x;
}
long long inp_ll() {
  long long x = 0;
  int f = 1;
  char ch;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  return x * f;
}
char B[25], *outs = B + 20, *outr = B + 20;
template <class T>
inline void print(register T a, register char x = 0) {
  if (x) *--outs = x, x = 0;
  if (!a)
    *--outs = '0';
  else
    while (a) *--outs = (a % 10) + 48, a /= 10;
  if (x) *--outs = x;
  fwrite(outs, outr - outs, 1, stdout);
  outs = outr;
}
};  // namespace io
using io ::inp;
using io ::inp_ll;
using io ::inpu;
using io ::print;
using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;
long long power(long long a, long long b, long long p) {
  if (!b) return 1;
  long long t = power(a, b / 2, p);
  t = t * t % p;
  if (b & 1) t = t * a % p;
  return t;
}
const int MAXN = 310;
const u64 MOD = 1000000007;
const f80 MI = f80(1) / MOD;
const int INF = 1000000010;
int n, m;
char s[MAXN][MAXN];
bool S(int x, int y) {
  return 1 <= x && x <= n && 1 <= y && y <= m && s[x][y] == '#';
}
int f[MAXN][MAXN][MAXN];
int F(int x, int y, int k) {
  if (1 <= x && x <= n && 1 <= y && y <= m)
    return f[x][y][k];
  else {
    if (x > n)
      return F(n, y + (x - n), k);
    else if (y < 1)
      return F(x - (1 - y), 1, k);
    else
      return 0;
  }
}
int g[MAXN][MAXN][MAXN];
int G(int x, int y, int k) {
  if (1 <= x && x <= n && 1 <= y && y <= m)
    return g[x][y][k];
  else {
    if (x > n)
      return G(n, y - (x - n), k);
    else if (y > m)
      return G(x - (y - m), m, k);
    else
      return 0;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%s", s[i] + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      for (int k = 0; k <= max(n, m); ++k) {
        f[i][j][k] = F(i - 1, j + 1, k) + (S(i, j) && S(i - k, j + k));
        g[i][j][k] = G(i - 1, j - 1, k) + (S(i, j) && S(i - k, j - k));
      }
    }
  long long ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      if (!S(i, j)) continue;
      for (int k = 1; k <= max(n, m); ++k) {
        ans += F(i, j - k * 2, k) - F(i - k - 1, j - k + 1, k);
        ans += F(i + k * 2, j, k) - F(i + k - 1, j + k + 1, k);
        ans += G(i, j + k * 2, k) - G(i - k - 1, j + k - 1, k);
        ans += G(i + k * 2, j, k) - G(i + k - 1, j - k - 1, k);
        bool a1 = S(i - k, j - k), a2 = S(i - k, j + k), a3 = S(i + k, j + k),
             a4 = S(i + k, j - k);
        if (S(i - k, j - k)) {
          ans += G(i - k, j + k, 0) - G(i - k * 2, j, 0);
          ans += G(i + k, j - k, 0) - G(i, j - k * 2, 0);
        }
        if (S(i - k, j + k)) {
          ans += F(i + k, j + k, 0) - F(i, j + k * 2, 0);
          ans += F(i - k, j - k, 0) - F(i - k * 2, j, 0);
        }
        if (S(i + k, j + k)) {
          ans += G(i + k * 2 - 1, j - 1, 0) - G(i + k - 1, j - k - 1, 0);
          ans += G(i - 1, j + k * 2 - 1, 0) - G(i - k - 1, j + k - 1, 0);
        }
        if (S(i + k, j - k)) {
          ans += F(i - 1, j - k * 2 + 1, 0) - F(i - k - 1, j - k + 1, 0);
          ans += F(i + k * 2 - 1, j + 1, 0) - F(i + k - 1, j + k + 1, 0);
        }
        ans -= a1 && a2;
        ans -= a2 && a3;
        ans -= a3 && a4;
        ans -= a4 && a1;
      }
    }
  cout << ans / 3 << endl;
  return 0;
}
