#include <bits/stdc++.h>
using namespace std;

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int64 H, W;
  cin >> H >> W;
  int64 gap = 305;
  vector<vector<int64>> sw(910, vector<int64>(910+1, 0)), sh(910+1, vector<int64>(910, 0));
  vector<vector<int64>> cnt(910, vector<int64>(910, 0));
  vector<PII> pts;
  REP(i, H) {
    string s;
    cin >> s;
    REP(j, W) {
      if (s[j] == '#') {
        sw[i+j+gap][i-j+gap] = 1;
        sh[i+j+gap][i-j+gap] = 1;
        cnt[i+j+gap][i-j+gap] = 1;
        pts.emplace_back(i+j+gap, i-j+gap);
      }
    }
  }
  REP(i, 910) {
    REP(j, 910) {
      sw[i][j+1] += sw[i][j];
      sh[i+1][j] += sh[i][j];
    }
  }
//  REP(i, 20) {
//    REP(j, 20) {
//      cout << cnt[i][j] << " ";
//    }
//    cout << endl;
//  }
//  cout << endl;
//  REP(i, 20) {
//    REP(j, 20) {
//      cout << sw[i][j] << " ";
//    }
//    cout << endl;
//  }
//  cout << endl;
//  REP(i, 20) {
//    REP(j, 20) {
//      cout << sh[i][j] << " ";
//    }
//    cout << endl;
//  }

  int64 res_2 = 0, res_3 = 0; // 2回数えるのと3回数えるの
  for (auto &p : pts) {
    int64 y = p.fs, x = p.sc;
//    cout << "point: " << y << " " << x << endl;
    for (int64 yy = p.fs-1; yy >= 0; yy--) {
      if (cnt[yy][x] == 0) continue;
      int64 dis = y-yy;
      if (y-yy <= x) {
        res_2 += sh[y-1][x-dis]-sh[yy][x-dis];
        res_3 += cnt[yy][x-dis] + cnt[y][x-dis];
      }
      if (x + dis < 910) {
        res_2 += sh[y-1][x+dis]-sh[yy][x+dis];
        res_3 += cnt[yy][x+dis]+cnt[y][x+dis];
      }
//      cout << "point: " << yy << " " << x << ": " << res_2 << " " << res_3 << endl;
    }
//    cout << res_2 << " " << res_3 << endl;
    for (int64 yy = p.fs+1; yy < 910; yy++) {
      if (cnt[yy][x] == 0) continue;
      int64 dis = yy-y;
      if (dis <= x) {
        res_2 += sh[yy-1][x-dis]-sh[y][x-dis];
        res_3 += cnt[y][x-dis] + cnt[yy][x-dis];
      }
      if (x + dis < 910) {
        res_2 += sh[yy-1][x+dis]-sh[y][x+dis];
        res_3 += cnt[y][x+dis]+cnt[yy][x+dis];
      }
//      cout << "point: " << yy << " " << x << ": " << res_2 << " " << res_3 << endl;
    }
//    cout << res_2 << " " << res_3 << endl;
    // -----------------------------------------
    for (int64 xx = p.sc-1; xx >= 0; xx--) {
      if (cnt[y][xx] == 0) continue;
      int64 dis = x-xx;
      if (dis <= y) {
        res_2 += sw[y-dis][x-1]-sw[y-dis][xx];
        res_3 += cnt[y-dis][x] + cnt[y-dis][xx];
      }
      if (y + dis < 910) {
        res_2 += sw[y+dis][x-1]-sw[y+dis][xx];
        res_3 += cnt[y+dis][x]+cnt[y+dis][xx];
      }
//      cout << "point: " << y << " " << xx << ": " << res_2 << " " << res_3 << endl;
    }
//    cout << res_2 << " " << res_3 << endl;
    for (int64 xx = p.sc+1; xx < 910; xx++) {
      if (cnt[y][xx] == 0) continue;
      int64 dis = xx-x;
      if (dis <= y) {
        res_2 += sw[y-dis][xx-1]-sw[y-dis][x];
        res_3 += cnt[y-dis][xx] + cnt[y-dis][x];
      }
      if (y + dis < 910) {
        res_2 += sw[y+dis][xx-1]-sw[y+dis][x];
        res_3 += cnt[y+dis][x]+cnt[y+dis][xx];
      }
//      cout << "point: " << y << " " << xx << ": " << res_2 << " " << res_3 << endl;
    }
//    cout << res_2 << " " << res_3 << endl;
//    cout << endl;
  }
  cout << res_2/2+res_3/4 << endl;
}
