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 Index Tree (2-dimension)
class BIT2:
    # H*W
    def __init__(self, h, w):
        self.w = w
        self.h = h
        self.data = [{} for i in range(h+1)]

    # O(logH*logW)
    def sum(self, i, j):
        s = 0
        data = self.data
        while i > 0:
            el = data[i]
            k = j
            while k > 0:
                s += el.get(k, 0)
                k -= k & -k
            i -= i & -i
        return s

    # O(logH*logW)
    def add(self, i, j, x):
        i += 1
        j += 1
        w = self.w; h = self.h
        data = self.data
        while i <= h:
            el = data[i]
            k = j
            while k <= w:
                el[k] = el.get(k, 0) + x
                k += k & -k
            i += i & -i

    # [x0, x1) x [y0, y1)
    def range_sum(self, x0, x1, y0, y1):
        return self.sum(x1, y1) - self.sum(x1, y0) - self.sum(x0, y1) + self.sum(x0, y0)


h,w = na()
c = [input() 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(f[sx][sy])
        else:
            ff.append(w+1)
        sx += 1
        sy -= 1
        i += 1
    sy = min(t, w-1)
    sx = t-sy
    x,y = sx,sy
    i = 0
    l = 0
    bit = BIT2(len(ff), w+1)
    #print(ff)
    for i,x in enumerate(ff):
        bit.add(i, x, 1)
    #print(t, ff)
    i = 0
    while sx < h and sy >= 0:
        #print(i)
        if c[sx][sy] == "z":
            #print(i - min(g[sx][sy]-sy, l), i+1, 0, sy+1, bit.range_sum(i - min(g[sx][sy]-sy, l), i+1, 0, sy+1))
            ans += bit.range_sum(i - min(g[sx][sy]-sy, l), i+1, 0, sy+1)
            l += 1
        else:
            l = 0
        sx += 1
        sy -= 1
        i += 1
print(ans)
