A tourist wants to visit country Zeydabad for Zbazi (a local game in Zeydabad).

The country Zeydabad is a rectangular table consisting of n rows and m columns. Each cell on the country is either 'z' or '.'.

The tourist knows this country is named Zeydabad because there are lots of ''Z-pattern"s in the country. A ''Z-pattern" is a square which anti-diagonal is completely filled with 'z' and its upper and lower rows are also completely filled with 'z'. All other cells of a square can be arbitrary.

<image>

Note that a ''Z-pattern" can consist of only one cell (see the examples).

So he wants to count the number of ''Z-pattern"s in the country (a necessary skill for Zbazi).

Now your task is to help tourist with counting number of ''Z-pattern"s.

As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use gets/scanf/printf instead of getline/cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.

Input

The first line contains two integers n, m (1 ≤ n, m ≤ 3000) — the number of rows and columns respectively.

Each of the next n lines contains m characters 'z' or '.' — the description of Zeydabad.

Output

Print the only integer a — the number of ''Z-pattern"s in Zeydabad.

Examples

Input

4 4
zzzz
zzz.
.z..
zzzz


Output

16


Input

1 4
z.z.


Output

2


Input

2 2
zz
zz


Output

5
#include <bits/stdc++.h>
using namespace std;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const long long NLINF = 0xf7f7f7f7f7f7f7f7;
const int INF = 0x3f3f3f3f, NINF = 0xf7f7f7f7;
const int MOD1 = 1e9 + 7, MOD2 = 1e9 + 9;
const int N = 3e3 + 10;
int n, m;
short nxtr[N][N], nxtd[2 * N][N], pos[N][N];
char g[N][N];
long long ans = 0LL;
struct P {
  int v[20 * N], l[20 * N], r[20 * N], cnt = 1;
  P() {
    memset(v, 0, sizeof v);
    memset(l, 0, sizeof l);
    memset(r, 0, sizeof r);
  }
  int upd(int old, int pos, int val, int beg = 1, int end = N) {
    if (beg == end) {
      v[cnt] = v[old] + val;
      return cnt++;
    }
    int mid = (beg + end) >> 1, ans = cnt++;
    l[ans] = l[old], r[ans] = r[old];
    if (pos <= mid)
      l[ans] = upd(l[ans], pos, val, beg, mid);
    else
      r[ans] = upd(r[ans], pos, val, mid + 1, end);
    v[ans] = v[l[ans]] + v[r[ans]];
    return ans;
  }
  int get(int no, int a, int b, int beg = 1, int end = N) const {
    if (!no || b < beg || end < a) return 0;
    if (a <= beg && end <= b) return v[no];
    int mid = (beg + end) >> 1;
    return get(l[no], a, b, beg, mid) + get(r[no], a, b, mid + 1, end);
  }
};
void inc(int i, int j, const vector<int>& v, const P& pst) {
  int k, k_, p, ii, val;
  p = pos[i][j], ii = i + j - 1;
  k = nxtr[i][j] - j, k_ = nxtd[ii][p] - p;
  val = min(k, k_);
  int r = pst.get(v[i], i + 1, INF) - pst.get(v[i - val], i + 1, INF);
  ans += (long long)r;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf(" %c", &g[i][j]);
  for (int i = 1; i <= n; i++) {
    int cur = m + 1;
    for (int j = m; j > 0; j--) {
      if (g[i][j] == 'z')
        nxtr[i][j] = cur;
      else
        cur = j;
    }
  }
  for (int i = 1; i <= n; i++) {
    vector<char> d;
    int i_ = i, j_ = 1;
    while (i_ > 0 && j_ <= m) {
      pos[i_][j_] = d.size() + 1;
      d.push_back(g[i_--][j_++]);
    }
    int cur = d.size() + 1;
    for (int j = d.size() - 1; j >= 0; j--) {
      if (d[j] == 'z')
        nxtd[i_ + j_ - 1][j + 1] = cur;
      else
        cur = j + 1;
    }
  }
  for (int j = 2; j <= m; j++) {
    vector<char> d;
    int i_ = n, j_ = j;
    while (i_ > 0 && j_ <= m) {
      pos[i_][j_] = d.size() + 1;
      d.push_back(g[i_--][j_++]);
    }
    int cur = d.size() + 1;
    for (int i = d.size() - 1; i >= 0; i--) {
      if (d[i] == 'z')
        nxtd[i_ + j_ - 1][i + 1] = cur;
      else
        cur = i + 1;
    }
  }
  for (int j = 1, i; j <= m; j++) {
    vector<int> v;
    v.reserve(n + 1);
    P p;
    v.push_back(0);
    for (i = 1; i <= n; i++)
      v.push_back(p.upd(v.back(), nxtr[i][j] - j + i, 1));
    for (i = 1; i <= n; i++)
      if (g[i][j] == 'z') inc(i, j, v, p);
  }
  printf("%lld\n", ans);
}
