#include <bits/stdc++.h>
using namespace std;
int trans1(char c) {
  if (c == '.') return 0;
  return 1;
}
int xx[4] = {0, 0, -1, 1};
int yy[4] = {-1, 1, 0, 0};
long long cnt[305][305][4][305];
long long sumx[305][305][4][305];
int n, m;
int Z[305][305];
void init() {
  register int i, j, k;
  memset(cnt, 0, sizeof(cnt));
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      for (k = 1; k < i; k++) cnt[i][j][0][k] = cnt[i - 1][j][0][k - 1];
      cnt[i][j][0][0] = Z[i][j];
    }
  }
  for (i = n; i >= 1; i--) {
    for (j = 1; j <= m; j++) {
      for (k = 1; k < n - i + 1; k++) cnt[i][j][1][k] = cnt[i + 1][j][1][k - 1];
      cnt[i][j][1][0] = Z[i][j];
    }
  }
  for (j = 1; j <= m; j++) {
    for (i = 1; i <= n; i++) {
      for (k = 1; k < j; k++) cnt[i][j][2][k] = cnt[i][j - 1][2][k - 1];
      cnt[i][j][2][0] = Z[i][j];
    }
  }
  for (j = m; j >= 1; j--) {
    for (i = 1; i <= n; i++) {
      for (k = 1; k < m - j + 1; k++) cnt[i][j][3][k] = cnt[i][j + 1][3][k - 1];
      cnt[i][j][3][0] = Z[i][j];
    }
  }
}
int n1, m1;
int minlen(int nx, int ny) { return min(n, m); }
long long getans1() {
  register int i, j, k;
  long long sumz = 0;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      for (k = 1; k <= minlen(i, j); k++) {
        long long sum = 0;
        for (int l = 0; l < 4; l++) sum += cnt[i][j][l][k];
        if (sum == 3) sumz++;
        if (sum == 4) sumz += 4;
      }
    }
  return sumz;
}
void initc() {
  register int i, j, k;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      for (k = 1; k <= minlen(i, j); k++)
        sumx[i][j][0][k] = sumx[i - 1][j][0][k - 1] + cnt[i][j][2][k];
      sumx[i][j][0][0] = Z[i][j];
    }
  for (i = 1; i <= n; i++)
    for (j = m; j >= 1; j--) {
      for (k = 1; k <= minlen(i, j); k++)
        sumx[i][j][1][k] = sumx[i - 1][j][1][k - 1] + cnt[i][j][3][k];
      sumx[i][j][1][0] = Z[i][j];
    }
  for (i = n; i >= 1; i--)
    for (j = 1; j <= m; j++) {
      for (k = 1; k <= minlen(i, j); k++)
        sumx[i][j][2][k] = sumx[i + 1][j][2][k - 1] + cnt[i][j][2][k];
      sumx[i][j][2][0] = Z[i][j];
    }
  for (i = n; i >= 1; i--)
    for (j = m; j >= 1; j--) {
      for (k = 1; k <= minlen(i, j); k++)
        sumx[i][j][3][k] = sumx[i + 1][j][3][k - 1] + cnt[i][j][3][k];
      sumx[i][j][3][0] = Z[i][j];
    }
}
long long getans2() {
  register int i, j, k;
  long long sum = 0;
  initc();
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      for (k = 1; k <= minlen(i, j); k++) {
        sum += (sumx[i][j][0][k] - cnt[i][j][0][k] - cnt[i][j][2][k]) *
               cnt[i][j][3][k] * cnt[i][j][1][k];
        sum += (sumx[i][j][1][k] - cnt[i][j][0][k] - cnt[i][j][3][k]) *
               cnt[i][j][2][k] * cnt[i][j][1][k];
        sum += (sumx[i][j][2][k] - cnt[i][j][1][k] - cnt[i][j][2][k]) *
               cnt[i][j][3][k] * cnt[i][j][0][k];
        sum += (sumx[i][j][3][k] - cnt[i][j][1][k] - cnt[i][j][3][k]) *
               cnt[i][j][2][k] * cnt[i][j][0][k];
      }
    }
  return sum;
}
char str[1005];
int main() {
  int i, j;
  scanf("%d%d", &n, &m);
  n1 = n / 2, m1 = m / 2;
  for (i = 1; i <= n; i++) {
    scanf("%s", str);
    for (j = 0; j < m; j++) Z[i][j + 1] = trans1(str[j]);
  }
  init();
  long long ans = 0;
  ans = getans1();
  printf("%lld\n", ans + getans2());
  return 0;
}
