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 int MAXN = 3123;
int first_to_left[MAXN][MAXN];
int last_to_right[MAXN][MAXN];
char matrix[MAXN][MAXN];
int n, m;
int bit[MAXN];
void update_bit(int idx) {
  while (idx <= n) {
    bit[idx]++;
    idx += (idx & -idx);
  }
}
int query_bit(int idx) {
  int sum = 0;
  while (idx > 0) {
    sum += bit[idx];
    idx -= (idx & -idx);
  }
  return sum;
}
struct event {
  int time;
  int index;
  event(){};
  event(int _time, int _index) {
    time = _time;
    index = _index;
  }
};
int cur_event;
vector<event> events;
bool comp_events(event a, event b) {
  if (a.time == b.time) {
    return a.index < b.index;
  } else {
    return a.time < b.time;
  }
}
void prepare_events() {
  sort(events.begin(), events.end(), comp_events);
  for (int i = 1; i <= n; i++) {
    bit[i] = 0;
  }
  cur_event = 0;
}
int query_events(int ini, int fim) {
  while (cur_event < (int)events.size() && events[cur_event].time <= ini) {
    update_bit(events[cur_event].index);
    cur_event++;
  }
  return query_bit(fim) - query_bit(ini - 1);
}
void precompute_stuff() {
  for (int i = 1; i <= n; i++) {
    int cur_first = 1;
    for (int k = 1; k <= m; k++) {
      if (matrix[i][k] != 'z') {
        cur_first = k + 1;
      }
      first_to_left[i][k] = cur_first;
    }
    int cur_last = m;
    for (int k = m; k >= 1; k--) {
      if (matrix[i][k] != 'z') {
        cur_last = k - 1;
      }
      last_to_right[i][k] = cur_last;
    }
  }
}
int get_left_size(int i, int k) {
  int answer = k - first_to_left[i][k] + 1;
  if (answer < 0) answer = 0;
  return answer;
}
int get_right_size(int i, int k) {
  int answer = last_to_right[i][k] - k + 1;
  if (answer < 0) answer = 0;
  return answer;
}
int count_diagonal(int i, int k) {
  int answer = 0;
  do {
    if (matrix[i][k] != 'z') {
      i++;
      k--;
      continue;
    }
    events.clear();
    int start_i = i;
    int start_k = k;
    int end_i = start_i;
    int end_k = start_k;
    while (end_i + 1 <= n && end_k - 1 >= 1 &&
           matrix[end_i + 1][end_k - 1] == 'z') {
      end_i++;
      end_k--;
    }
    int a = start_i, b = start_k;
    do {
      int right_size = get_right_size(a, b);
      int enter_time = max(start_i, a - right_size + 1);
      events.push_back(event(enter_time, a));
      a++;
      b--;
    } while (a <= end_i);
    prepare_events();
    a = start_i;
    b = start_k;
    do {
      int left_size = get_left_size(a, b);
      int end_query = min(a + left_size - 1, n);
      answer += query_events(a, end_query);
      a++;
      b--;
    } while (a <= end_i);
    i = end_i + 1;
    k = end_k - 1;
  } while (i <= n && k >= 1);
  return answer;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int k = 1; k <= m; k++) {
      scanf(" %c", &matrix[i][k]);
    }
  }
  precompute_stuff();
  long long answer = 0LL;
  for (int i = 1; i <= m; i++) {
    answer += count_diagonal(1, i);
  }
  for (int i = 2; i <= n; i++) {
    answer += count_diagonal(i, m);
  }
  printf("%I64d\n", answer);
  return 0;
}
