#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

#define max(x, y) ((x)>(y)?(x):(y))
#define min(x, y) ((x)<(y)?(x):(y))

char field[324][324];
Int lsum[323][324];
Int rsum[324][324];
Int res = 0;
Int h, w;
Int cntl(Int x, Int y){
  if(x-y < 1-w || x-y > h-1)return 0;
  if(x < 0){
    Int k = -x;
    x += k;
    y += k;
  }
  if(y < 0){
    Int k = -y;
    x += k;
    y += k;
  }
  if(x > h){
    Int k = x-h;
    x -= k;
    y -= k;
  }
  if(y > w+1){
    Int k = y-w-1;
    x -= k;
    y -= k;
  }
  return lsum[x][y];
}

Int cntr(Int x, Int y){
  if(x+y < 2 || x+y > h+w)return 0;
  if(x < 0){
    Int k = -x;
    x += k;
    y -= k;
  }
  if(y < 0){
    Int k = -y;
    x -= k;
    y += k;
  }
  if(x > h){
    Int k = x-h;
    x -= k;
    y += k;
  }
  if(y > w+1){
    Int k = y-w-1;
    x += k;
    y -= k;
  }
  return rsum[x][y];
}

int main(){
  cin >> h >> w;
  for(Int i = 1;i <= h;i++){
    for(Int j = 1;j <= w;j++){
	cin >> field[i][j];
    } 
  }
  for(Int i = 0;i <= h;i++){
    for(Int j = 0;j <= w+1;j++){
      if(i == 0 || j == 0)lsum[i][j] = 0;
      else lsum[i][j] = lsum[i-1][j-1] + (field[i][j] == '#');
      if(i == 0 || j == w+1)rsum[i][j] = 0;
      else rsum[i][j] = rsum[i-1][j+1] + (field[i][j] == '#');
    }
  }

  for(Int i = 1;i <= h;i++){
    for(Int j = 1;j <= w;j++){
      if(field[i][j] == '.')continue;
      Int xi = i+1, xj = j+1;
      for(;xi <= h && xj <= w;xi++,xj++){
	if(field[xi][xj] == '.')continue;
	res += cntl(xi+xi-i,j)-cntl(xi-1,j+j-xj-1);
	res += cntl(i,xj+xj-j) - cntl(i+i-xi-1, xj-1);
      }
      xi = i+1, xj = j-1;
      for(;xi <= h && xj >= 1;xi++,xj--){
	if(field[xi][xj] == '.')continue;
	res += cntr(xi+xi-i-1,j+1) - cntr(xi,j+j-xj);
	//	cout << i << " " << j << " " << xi << " " << xj << endl;
	//cout << xi+xi-i-1 << " " << j+1 << " " << xi << " " << j+j-xj << endl;
	//cout << cntr(xi+xi-i-1,j+1) << " "  <<  cntr(xi,j+j-xj) << endl;
	res += cntr(i-1,xj+xj-j+1) - cntr(i+i-xi,xj);
      }
    }
  }
  cout << res << endl;
  return 0;
}