#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 500


int main(){
	char c[N + 1];
	f(i, N + 1)c[i] = 0;
	bool a[N + 2][N + 2];
	long long b[N+2][N+2];
	long long d[N+2][N+2];
	f(i, N+2){
		f(j, N+2){
			a[i][j] = false;
			b[i][j] = 0;
			d[i][j] = 0;
		}
	}
	int n, m, k;
	int x, y, z, xx, yy, zz;
	long long s, ans;
	bool v = true;
	s = 0;
	ans = 0;
	scanf("%d %d", &n, &m);
	f(i, n){
		scanf("%s", c);
		f(j, m){
			if (c[j] == '#')a[i + 1][j + 1] = true;
		}
	}
	f(i, n+2){
		f(j, m+2){
			if (i == 0 | j == 0)b[i][j] = 0;
			else{
				if (a[i - 1][j - 1])b[i][j] = b[i - 1][j - 1] + 1;
				else b[i][j] = b[i - 1][j - 1];
			}
		}
	}
	f(i, n + 2){
		for (int j = m+1; j >= 0; j--){
			if (i == 0 | j == m+1)d[i][j] = 0;
			else{
				if (a[i - 1][j + 1])d[i][j] = d[i - 1][j + 1] + 1;
				else d[i][j] = d[i - 1][j + 1];
			}
		}
	}


	
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			if (a[i][j]){
				for (int ii = 1;; ii++){
					if (i + ii > n || j + ii > m)break;
					if (a[i + ii][j + ii]){
						if (i + 1 + (2 * ii) <= (n + j)){
							x = i + ii;
							y = j - ii;
							if (y <= 0){
								x += 1 - y;
								y = 1;
							}
							xx = i + (2 * ii);
							yy = j;
							if (xx > n){
								yy -= (xx - n);
								xx = n;
							}
							if (x <= xx){
								ans += (b[xx + 1][yy + 1] - b[x][y]);
							}
						}

						if (j + 1 + (2 * ii) <= (m + i)){
							x = i - ii;
							y = j + ii;
							if (x <= 0){
								y += 1 - x;
								x = 1;
							}
							xx = i;
							yy = j + (2 * ii);
							if (yy > m){
								xx -= (yy - m);
								yy = m;
							}

							if (x <= xx){
								ans += (b[xx + 1][yy + 1] - b[x][y]);
							}
						}
					}
				}
			}
		}
	}


	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			if (a[i][j]){
				for (int ii = 1;; ii++){
					if (i + ii > n || j - ii <1)break;
						if (a[i + ii][j - ii]){
							if (i + j + (2 * ii) <= (n + m)){
							x = i + ii;
							y = j + ii;
							if (y > m){
								x += (y - m);
								y = m;
							}
							xx = i + (2 * ii);
							yy = j;
							if (xx > n){
								yy += (xx - n);
								xx = n;
							}

							if (x <= xx){
								ans += (d[xx + 1][yy - 1] - d[x][y]);
							}
						}
							if ((2 * ii) + 2 <= (i + j)){
							x = i - ii;
							y = j - ii;
							if (x <= 0){
								y -= (1 - x);
								x = 1;
							}
							xx = i;
							yy = j - (2 * ii);
							if (yy <= 0){
								xx -= (1 - yy);
								yy = 1;
							}
							if (x <= xx){
								ans += (d[xx + 1][yy - 1] - d[x][y]);
							}
						}
							x = i - ii;
							y = j - ii;
							if (x > 0 && y > 0&&x<=n&&y<=m){
								if (a[x][y])ans--;
							}
							x = i;
							y = j - (2*ii);
							if (x>0 && y > 0 && x <= n&&y <= m){
								if (a[x][y])ans--;
							}

							x = i + ii;
							y = j + ii;
							if (x > 0 && y > 0 && x <= n&&y <= m){
								if (a[x][y])ans--;
							}
							x = i + (2 * ii);
							y = j;
							if (x>0 && y > 0 && x <= n&&y <= m){
								if (a[x][y])ans--;
							}


					}
				}
			}
		}
	}



	printf("%lld\n", ans);


	return 0;
}

Measured memory_bytes: 4352