#include <bits/stdc++.h>
using namespace std;
int h, w, n;
char c[305][305];
long long sum[705][705];
long long Zero = 355;
long long calc() {
  long long ret = 0;
  for (int u = -n; u <= n; u++) {
    for (int v = 0; v <= 2 * n; v++) {
      sum[Zero + u][v] = 0;
    }
  }
  for (int x = 1; x <= n; x++) {
    for (int y = 1; y <= n; y++) {
      if (c[x][y] == '.') continue;
      int u = x - y, v = x + y;
      sum[Zero + u][v]++;
    }
  }
  for (int u = -n; u <= n; u++) {
    for (int v = 0; v <= 2 * n; v++) {
      if (v > 0) sum[Zero + u][v] += sum[Zero + u][v - 1];
    }
  }
  for (int x = 1; x <= n; x++) {
    for (int y = 1; y <= n; y++) {
      if (c[x][y] == '.') continue;
      for (int d = 1; d <= n; d++) {
        if (x + d > n || y + d > n) break;
        if (c[x + d][y + d] == '.') continue;
        int u = x - y, v = x + y;
        ret += sum[Zero + u - 2 * d][v + 2 * d] - sum[Zero + u - 2 * d][v] +
               1000000007;
        ret %= 1000000007;
      }
    }
  }
  return ret;
}
char t[305][305];
void rot() {
  for (int x = 1; x <= n; x++) {
    for (int y = 1; y <= n; y++) {
      t[x][y] = c[y][n - x + 1];
    }
  }
  for (int x = 1; x <= n; x++) {
    for (int y = 1; y <= n; y++) {
      c[x][y] = t[x][y];
    }
  }
}
int main(void) {
  cin >> h >> w;
  n = max(h, w);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      c[i][j] = '.';
    }
  }
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      cin >> c[j][i];
    }
  }
  long long ans = 0;
  for (int i = 0; i < 4; i++) {
    ans += calc(), ans %= 1000000007;
    rot();
  }
  cout << ans << endl;
  return 0;
}
