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 const N = 3e3 + 4;
int const M = (1 << 13);
char plansza[N][N];
int maxleft[N][N];
int maxright[N][N];
int maxslash[N][N];
using ll = long long;
ll ans = 0;
int t[M];
vector<int> schowek[N];
void build(int v, int tl, int tr) {
  if (tl == tr)
    t[v] = 0;
  else {
    int mid = (tl + tr) >> 1;
    build(v << 1, tl, mid);
    build((v << 1) + 1, mid + 1, tr);
    t[v] = t[v * 2] + t[v * 2 + 1];
  }
}
int query(int v, int l, int r, int tl, int tr) {
  if (r < l) return 0;
  if (l == tl && r == tr)
    return t[v];
  else {
    int mid = (tl + tr) / 2;
    int qw1 = query(2 * v, l, min(mid, r), tl, mid);
    int qw2 = query(2 * v + 1, max(mid + 1, l), r, mid + 1, tr);
    return qw1 + qw2;
  }
}
void update(int v, int pos, int tl, int tr, int val) {
  if (tl == tr) {
    t[v] += val;
  } else {
    int mid = (tl + tr) >> 1;
    if (pos <= mid)
      update(v << 1, pos, tl, mid, val);
    else
      update((v << 1) + 1, pos, mid + 1, tr, val);
    t[v] = t[v << 1] + t[(v << 1) + 1];
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", &plansza[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (plansza[i - 1][j - 1] == 'z' && j - 1 == 0)
        maxleft[i][j] = 1;
      else if (plansza[i - 1][j - 1] == 'z' && plansza[i - 1][j - 2] == 'z')
        maxleft[i][j] = maxleft[i][j - 1];
      else if (plansza[i - 1][j - 1] == 'z')
        maxleft[i][j] = j;
    }
    for (int j = m; j > 0; j--) {
      if (plansza[i - 1][j - 1] == 'z' && j - 1 == m - 1)
        maxright[i][j] = m;
      else if (plansza[i - 1][j - 1] == 'z' && plansza[i - 1][j] == 'z')
        maxright[i][j] = maxright[i][j + 1];
      else if (plansza[i - 1][j - 1] == 'z')
        maxright[i][j] = j;
    }
  }
  for (int i = 2; i <= m + n; i++) {
    for (int j = min(n, i - 1); j > max(0, i - m - 1); j--) {
      if (plansza[j - 1][i - j - 1] == 'z' && (j == n || i - j == 1))
        maxslash[j][i - j] = i - j;
      else if (plansza[j - 1][i - j - 1] == 'z' && plansza[j][i - j - 2] == 'z')
        maxslash[j][i - j] = maxslash[j + 1][i - j - 1];
      else if (plansza[j - 1][i - j - 1] == 'z')
        maxslash[j][i - j] = i - j;
    }
  }
  for (int i = 2; i <= m + n; i++) {
    for (int j = min(n, i - 1); j > max(0, i - m - 1); j--) {
      if (maxleft[j][i - j] == 0) continue;
      schowek[maxright[j][i - j]].push_back(i - j);
      update(1, i - j, 1, m, 1);
      for (int l = 0; l < schowek[i - j - 1].size(); l++) {
        update(1, schowek[i - j - 1][l], 1, m, -1);
      }
      int r = max(maxslash[j][i - j], maxleft[j][i - j]);
      ans += (ll)query(1, r, i - j, 1, m);
    }
    for (int i = 1; i <= m; i++) {
      schowek[i].clear();
    }
    build(1, 1, m);
  }
  printf("%I64d", ans);
  return 0;
}
