Problem: There are some coins in the xy-plane. The positions of the coins are represented by a grid of characters with H rows and W columns. If the character at the i-th row and j-th column, s_{ij}, is `#`, there is one coin at point (i,j); if that character is `.`, there is no coin at point (i,j). There are no other coins in the xy-plane.

There is no coin at point (x,y) where 1\leq i\leq H,1\leq j\leq W does not hold. There is also no coin at point (x,y) where x or y (or both) is not an integer. Additionally, two or more coins never exist at the same point.

Find the number of triples of different coins that satisfy the following condition:

* Choosing any two of the three coins would result in the same Manhattan distance between the points where they exist.



Here, the Manhattan distance between points (x,y) and (x',y') is |x-x'|+|y-y'|. Two triples are considered the same if the only difference between them is the order of the coins.

Constraints

* 1 \leq H,W \leq 300
* s_{ij} is `#` or `.`.

Input

Input is given from Standard Input in the following format:


H W
s_{11}...s_{1W}
:
s_{H1}...s_{HW}


Output

Print the number of triples that satisfy the condition.

Examples

Input

5 4
#.##
.##.
#...
..##
...#


Output

3


Input

5 4
.##
.##.
...
..##
...#


Output

3


Input

13 27
......#.........#.......#..
...#.....###..
..............#####...##...
...#######......#...#######
...#.....#.....###...#...#.
...#######....#.#.#.#.###.#
..............#.#.#...#.#..
.#.#.#...###..
...........#...#...#######
..#######..#...#...#.....#
..#.....#..#...#...#.###.#
..#######..#...#...#.#.#.#
..........##...#...#.#####


Output

870

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
#define ll long long
using namespace std;
char c[1015][1015]; ll _s[1015][1015+1015]; int _gg[1015][1015+1015],n,m;
struct P{int x,y;}a[1015*1015];vector<P>v1[1015],_v2[1015+1015];
#define s(x,y) _s[x][y+1015]
#define gg(x,y) _gg[x][y+1015]
#define v2(x) _v2[x+1015]
inline int S(int x1,int y1,int x2,int y2){if(x1>x2||y1>y2||x1<2||x2>n+m||y1<1-m||y2>n-1)return 0;
return s(x2,y2)-s(x2,y1-1)-s(x1-1,y2)+s(x1-1,y1-1);}
inline bool cmp1(P x,P y){return x.y<y.y;}inline bool cmp2(P x,P y){return x.x<y.x;}
int main()
{
	int t=0; ll s1=0,s2=0; cin>>n>>m;for(int i=1;i<=n;i++) scanf("%s",c[i]+1);
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(c[i][j]=='#')
		a[++t]=P{i+j,i-j},v1[i+j].push_back(a[t]),v2(i-j).push_back(a[t]),gg(i+j,i-j)++;
	for(int i=2;i<=n+m;i++) sort(v1[i].begin(),v1[i].end(),cmp1);
	for(int i=1-m;i<=n-1;i++) sort(v2(i).begin(),v2(i).end(),cmp2);
	for(int i=2;i<=n+m;i++) for(int j=1-m;j<=n-1;j++) s(i,j)=s(i-1,j)+s(i,j-1)-s(i-1,j-1)+gg(i,j);
	for(int i=2;i<=n+m;i++) for(int j=0;j<v1[i].size();j++) for(int k=j+1;k<v1[i].size();k++)
	{
		P x=v1[i][j],y=v1[i][k];int d=y.y-x.y;
		s1+=S(x.x+d,x.y+1,x.x+d,y.y-1)+S(x.x-d,x.y+1,x.x-d,y.y-1);
		s2+=S(x.x+d,x.y,x.x+d,x.y)+S(x.x+d,y.y,x.x+d,y.y)+S(x.x-d,x.y,x.x-d,x.y)+S(x.x-d,y.y,x.x-d,y.y);
	}
	for(int i=1-m;i<=n-1;i++) for(int j=0;j<v2(i).size();j++) for(int k=j+1;k<v2(i).size();k++)
	{
		P x=v2(i)[j],y=v2(i)[k];int d=y.x-x.x;
		s1+=S(x.x+1,x.y+d,y.x-1,x.y+d)+S(x.x+1,x.y-d,y.x-1,x.y-d);
		s2+=S(x.x,x.y+d,x.x,x.y+d)+S(y.x,x.y+d,y.x,x.y+d)+S(x.x,x.y-d,x.x,x.y-d)+S(y.x,x.y-d,y.x,x.y-d);
	}
	cout<<s1+s2/2;
}