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.

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.
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.
none
4 4
zzzz
zzz.
.z..
zzzz
16
1 4
z.z.
2
2 2
zz
zz
5
import sys
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
# Binary Indexed Tree (Fenwick Tree)
# 0-indexed
class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
        self.el = [0]*(n+1)
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s
    def add(self, i, x):
        assert 0 <= i < self.n
        i = i+1
        self.el[i] += x
        while i <= self.n:
            self.data[i] += x
            i += i & -i
    def set(self, i, x):
        assert 0 <= i <= self.n
        self.add(i,x-self.get(i))
    def get(self, i, j=None):# j=Noneのときiを取得, [i, j)の和を取得
        if j is None:
            return self.el[i+1]
        return self.sum(j) - self.sum(i)
from collections import defaultdict
def solve(f):
    n = len(f)
    if len(f) == 0:
        return 0
    a,b = zip(*f)
    d = defaultdict(list)
    bit = BIT(n)
    for i in range(n):
        d[a[i] + i].append(i)
    for i in range(n):
        bit.add(i, 1)
    res = 0
    for i in range(n):
        for j in d[i]:
            bit.add(j, -1)
        #print(n,0,b[i]-i-1)
        res += bit.get(i-b[i]+1, i+1)
    #print(a,b,res)
    return res
    

h,w = na()
c = [input() for i in range(h)]
"""h = 1000
w = 3000
from random import randint
c = [[["z","."][randint(0,1)]for j in range(w)] for i in range(h)]"""
m = min(h, w)
ans = 0

f = [[w + 1 for i in range(w)]for j in range(h)]
for i in range(h):
    if c[i][0] == "z":
        f[i][0] = 0

for i in range(h):
    for j in range(1, w):
        if c[i][j] == "z":
            f[i][j] = min(j, f[i][j-1])

g = [[-1 for i in range(w)]for j in range(h)]
for i in range(h):
    if c[i][-1] == "z":
        g[i][-1] = w-1

for i in range(h):
    for j in range(w-2,-1,-1):
        if c[i][j] == "z":
            g[i][j] = max(j, g[i][j+1])


for t in range(h+w-1):
    sy = min(t, w-1)
    sx = t-sy
    x,y = sx,sy
    i = 0
    l = 0
    ff = []
    while sx < h and sy >= 0:
        if c[sx][sy] == "z":
            ff.append((sy-f[sx][sy]+1, g[sx][sy]-sy+1))
        else:
            ans += solve(ff)
            ff = []
        sx += 1
        sy -= 1
        i += 1
    ans += solve(ff)

print(ans)
