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>
using namespace std;
namespace whatever{
	int readu(){
		char ch=getchar();
		while(!isdigit(ch))
			ch=getchar();
		int value=ch-'0';
		ch=getchar();
		while(isdigit(ch)){
			value=value*10+ch-'0';
			ch=getchar();
		}
		return value;
	}
	void writeull(long long n){
		if(n<10)
			putchar(n+'0');
		else{
			writeull(n/10);
			putchar(n%10+'0');
		}
	}
	void run(){
		cerr<<"time(0): "<<time(0)<<endl;
		int h=readu();
		int w=readu();
		static char s[300][301];
		for(int i=0; i<h; ++i){
			gets(s[i]);
			assert(int(strlen(s[i]))==w);
		}
		static int cnt[300][300];
		long long result=0;
		int first_a;
		int last_a;
		memset(cnt, 0, sizeof(cnt));
		for(int i=0; i<h; ++i)
			for(int j=0; j<w; ++j){
				cnt[i][j]=int(s[i][j]=='#');
				if(i!=0&&j!=0)
					cnt[i][j]+=cnt[i-1][j-1];
			}
		for(int i=0; i<h; ++i)
			for(int j=0; j<w; ++j)
				if(s[i][j]=='#')
					for(int k=1; k<min(h-i, w-j); ++k)
						if(s[i+k][j+k]=='#'){
							first_a=max(0, k-i);
							last_a=min(k, w-(j+k)-1);
							if(first_a<=last_a){
								result+=cnt[i-k+last_a][j+k+last_a];
								if(i-k+first_a-1>=0&&j+k+first_a-1>=0)
									result-=cnt[i-k+first_a-1][j+k+first_a-1];
							}
							first_a=max(0, k-j);
							last_a=min(k, h-(i+k)-1);
							if(first_a<=last_a){
								result+=cnt[i+k+last_a][j-k+last_a];
								if(i+k+first_a-1>=0&&j-k+first_a-1>=0)
									result-=cnt[i+k+first_a-1][j-k+first_a-1];
							}
						}
		cerr<<"result: "<<result<<endl;
		for(int i=0; i<h; ++i)
			reverse(s[i], s[i]+w);
		memset(cnt, 0, sizeof(cnt));
		for(int i=0; i<h; ++i)
			for(int j=0; j<w; ++j){
				cnt[i][j]=int(s[i][j]=='#');
				if(i!=0&&j!=0)
					cnt[i][j]+=cnt[i-1][j-1];
			}
		for(int i=0; i<h; ++i)
			for(int j=0; j<w; ++j)
				if(s[i][j]=='#')
					for(int k=2; k<min(h-i, w-j); ++k)
						if(s[i+k][j+k]=='#'){
							first_a=max(1, k-i);
							last_a=min(k-1, w-(j+k)-1);
							if(first_a<=last_a){
								result+=cnt[i-k+last_a][j+k+last_a];
								if(i-k+first_a-1>=0&&j+k+first_a-1>=0)
									result-=cnt[i-k+first_a-1][j+k+first_a-1];
							}
							first_a=max(1, k-j);
							last_a=min(k-1, h-(i+k)-1);
							if(first_a<=last_a){
								result+=cnt[i+k+last_a][j-k+last_a];
								if(i+k+first_a-1>=0&&j-k+first_a-1>=0)
									result-=cnt[i+k+first_a-1][j-k+first_a-1];
							}
						}
		writeull(result);
		putchar('\n');
	}
}
int main(){
	whatever::run();
}