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;
int n, m;
int pref[3001][3001][2];
long long ans;
const int S = 1 << 12;
vector<int> tree[2 * S];
void clearr() {
  for (int i = 0; i < 2 * S; ++i) {
    tree[i].clear();
  }
}
void build() {
  for (int i = S - 1; i > 0; --i) {
    int i1 = 0;
    int s1 = tree[2 * i].size();
    int i2 = 0;
    int s2 = tree[2 * i + 1].size();
    while (i1 < s1 && i2 < s2) {
      if (tree[2 * i][i1] < tree[2 * i + 1][i2]) {
        tree[i].push_back(tree[2 * i][i1]);
        ++i1;
      } else {
        tree[i].push_back(tree[2 * i + 1][i2]);
        ++i2;
      }
    }
    while (i1 < s1) {
      tree[i].push_back(tree[2 * i][i1]);
      ++i1;
    }
    while (i2 < s2) {
      tree[i].push_back(tree[2 * i + 1][i2]);
      ++i2;
    }
  }
}
int calcc(vector<int>& v, int b) {
  int p = 0;
  int q = v.size() - 1;
  int s;
  if (v[q] < b) {
    return 0;
  }
  while (p < q) {
    int s = (p + q) / 2;
    if (v[s] >= b) {
      q = s;
    } else {
      p = s + 1;
    }
  }
  return v.size() - p;
}
int calcRec(int l, int r, int ll, int rr, int node, int b) {
  if (r < ll || rr < l) {
    return 0;
  }
  if (l <= ll && rr <= r) {
    return calcc(tree[node], b);
  }
  int ss = (ll + rr) / 2;
  return calcRec(l, r, ll, ss, 2 * node, b) +
         calcRec(l, r, ss + 1, rr, 2 * node + 1, b);
}
int calc(int l, int r, int b) { return calcRec(l, r, 0, S - 1, 1, b); }
void load() {
  cin >> n >> m;
  string s;
  for (int i = 1; i <= n; ++i) {
    cin >> s;
    for (int j = 1; j <= m; ++j) {
      pref[i][j][0] = pref[i][j - 1][0] + (s[j - 1] == 'z');
      pref[i][j][1] = pref[i - 1][j + 1][1] + (s[j - 1] == 'z');
    }
  }
}
int cuntLeft(int i, int j, int l) { return pref[i][j][0] - pref[i][j - l][0]; }
int cuntRight(int i, int j, int l) {
  return pref[i][j + l - 1][0] - pref[i][j - 1][0];
}
int cuntDiag(int i, int j, int l) {
  return pref[i + l - 1][j - l + 1][1] - pref[i - 1][j + 1][1];
}
int maxLeft(int i, int j) {
  int p = 0;
  int q = j;
  int s;
  while (p < q) {
    s = (p + q + 1) / 2;
    if (cuntLeft(i, j, s) == s) {
      p = s;
    } else {
      q = s - 1;
    }
  }
  return p;
}
int maxRight(int i, int j) {
  int p = 0;
  int q = m - j + 1;
  int s;
  while (p < q) {
    s = (p + q + 1) / 2;
    if (cuntRight(i, j, s) == s) {
      p = s;
    } else {
      q = s - 1;
    }
  }
  return p;
}
int maxDiag(int i, int j) {
  int p = 0;
  int q = min(j, n - i + 1);
  int s;
  while (p < q) {
    s = (p + q + 1) / 2;
    if (cuntDiag(i, j, s) == s) {
      p = s;
    } else {
      q = s - 1;
    }
  }
  return p;
}
void makeDiag(int d) {
  clearr();
  for (int i = max(1, d - m); i <= min(n, d - 1); ++i) {
    tree[S + i].push_back(maxRight(i, d - i) - i);
  }
  build();
  for (int i = max(1, d - m); i <= min(n, d - 1); ++i) {
    int l = min(maxLeft(i, d - i), maxDiag(i, d - i));
    ans += calc(i, i + l - 1, -i + 1);
  }
}
void solve() {
  for (int i = 2; i <= n + m; ++i) {
    makeDiag(i);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  load();
  solve();
  cout << ans << endl;
}
