#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
bool Map[90000];
int MinMinus(int sum,int H,int W){
	if(sum < W){
		return 0 - sum;
	} 
	return - W + 1;
}
int MaxMinus(int sum,int H,int W){
	if(sum < H){
		return sum;
	} 
	return 2*H-2-sum;
}
int MinPlus(int diff,int H,int W){
	if(-diff >= 0){
		return -diff;
	} 
	return diff;
}
int MaxPlus(int diff,int H,int W){
	if(H-1 - diff < W){
		return 2*H-2 - diff;
	} 
	return 2*W-2 + diff;
}
void Calc(){
	int H = rei();
	int W = rei();
	for(int i=0;i<H;i++){
		string S = res();
		for(int j=0;j<W;j++){
			Map[i*300+j] = S[j] == '#';
		}
	}
	long count = 0;
	for(int i=0;i<H+W-1;i++){
		for(int j=0;j<H+W-1;j++){
			if(i % 2 != j % 2 || i == j){
				continue;
			}
			int M23 = max(i-j,j-i);
			int c = 0;
			int p = MinMinus(i,H,W);
			int q = MinMinus(i,H,W);
			for(int k=MinMinus(j,H,W),l=MaxMinus(j,H,W)-M23;k<=l;k++){
				while(p <= k+M23){
					int XPY = i;
					int XMY = p;
					if((XPY-XMY) % 2 == 0){
						int X = (XPY + XMY) / 2;
						int Y = (XPY - XMY) / 2;
						if(X >= 0 && X < H && Y >= 0 && Y < W){
							if(Map[X*300+Y]){
								c++;
							}
						}
					}
					p++;
				}
				while(q <= k-1){
					int XPY = i;
					int XMY = q;
					if((XPY-XMY) % 2 == 0){
						int X = (XPY + XMY) / 2;
						int Y = (XPY - XMY) / 2;
						if(X >= 0 && X < H && Y >= 0 && Y < W){
							if(Map[X*300+Y]){
								c--;
							}
						}
					}
					q++;
				}
				int XPY1 = j;
				int XMY1 = k+M23;
				int XPY2 = j;
				int XMY2 = k;
				if((XPY1-XMY1) % 2 == 0 && (XPY2-XMY2) % 2 == 0){
					int X1 = (XPY1 + XMY1) / 2;
					int Y1 = (XPY1 - XMY1) / 2;
					int X2 = (XPY2 + XMY2) / 2;
					int Y2 = (XPY2 - XMY2) / 2;
					if(X1 >= 0 && X1 < H && Y1 >= 0 && Y1 < W && X2 >= 0 && X2 < H && Y2 >= 0 && Y2 < W){
						if(Map[X1*300+Y1] && Map[X2*300+Y2]){
							count += c;
						}
					}
				}
			}
		}
	}
	for(int i=-W+1;i<H;i++){
		for(int j=-W+1;j<H;j++){
			if((i-j) % 2 != 0 || i == j){
				continue;
			}
			int M23 = max(i-j,j-i);
			int c = 0;
			int p = MinPlus(i,H,W);
			int q = MinPlus(i,H,W);
			for(int k=MinPlus(j,H,W),l=MaxPlus(j,H,W)-M23;k<=l;k++){
				while(p < k+M23){
					int XMY = i;
					int XPY = p;
					if((XPY-XMY) % 2 == 0){
						int X = (XPY + XMY) / 2;
						int Y = (XPY - XMY) / 2;
						if(X >= 0 && X < H && Y >= 0 && Y < W){
							if(Map[X*300+Y]){
								c++;
							}
						}
					}
					p++;
				}
				while(q <= k){
					int XMY = i;
					int XPY = q;
					if((XPY-XMY) % 2 == 0){
						int X = (XPY + XMY) / 2;
						int Y = (XPY - XMY) / 2;
						if(X >= 0 && X < H && Y >= 0 && Y < W){
							if(Map[X*300+Y]){
								c--;
							}
						}
					}
					q++;
				}
				int XMY1 = j;
				int XPY1 = k+M23;
				int XMY2 = j;
				int XPY2 = k;
				if((XPY1-XMY1) % 2 == 0 && (XPY2-XMY2) % 2 == 0){
					int X1 = (XPY1 + XMY1) / 2;
					int Y1 = (XPY1 - XMY1) / 2;
					int X2 = (XPY2 + XMY2) / 2;
					int Y2 = (XPY2 - XMY2) / 2;
					if(X1 >= 0 && X1 < H && Y1 >= 0 && Y1 < W && X2 >= 0 && X2 < H && Y2 >= 0 && Y2 < W){
						if(Map[X1*300+Y1] && Map[X2*300+Y2]){
							count += c;
						}
					}
				}
			}
		}
	}
	cout << count << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 384