// 	                                                     V...TPsnnwwnnPC..............jm..............a..............................Aw
//                  .ymNq..                                Yq.en....ye....pc.....pM...............g......................................Y.
//            .ymPf.       ..YNwp...                   .c.......yc....yC......r................jE...h........j...je..........................Y
//     .pmPf..                       ....jC         r.......aN......g......yP..m.............jC...jb.........j....p..k..........................k
//     j.                                jH      y......yCg..vp...j....ycy.yjA..............p...pjO..........Fk...Op..k...........Jp..............h.
//     K                                 g       .      gJC.r...jN..r...bC.gjp...........M.F.jC..b..........jHj..jOH...k............Q...............Y
//    jN                                 k                 .jAbNfkC    .  f.b.........yC  gjC   j.h.........F. pjO.L....p............Jp...............C
//    jh                                 N                r.NNNj.                 ....    P.    KOjlPfYsw..y.  b.  L.....p.............Ap....W.........k
//    gH             qNNp                N              A...NNqb   ..                       .....                  ..  ..Jp..............Xp....q........L
//    B          jpNNNNNNNNNNNp          N            y.....lNj.      ....                                                Jp...............ln...Jp.......p
//   jC                     jNNC         N           A.......jN                                                            .p.................q...k......j
//  jE                   .gpNNP          N          C......jNNp                                                             .g..................V..t.....j.
//  .h                NNNNC.             N         b......KNNNh                                          ...                  t...................Xpj....j.
//   K.              gpp                 k        h.....gNNNNNN                                   .ugjgpppppppc                KW.......jp...........Q...j
//   jp             gNN.                 g       L.pn.gNNNNNNNNp     ......                     hP.............                NqNp......Jp............Y.F
//   jE            gNNgNNr   jNN         K      Z...gNNNNNNNNNNN.  upNNNNNNNNn                                                  jNNNp......Y..............C      Ap
//   Jh           gNNN..NNp jNNC         fH  .C...gNNNNNNNNNNNNNh. C.                                                           .jNp.Jp.....Jp..............Y..C...
//   jh          fNN.   JNNNNP.          jpz....jNNNNNNNNNNNNNNNNb.                                                               .  jNY......k.........Jq....JQ.C      ac..
//   jC            ...........            C...MfNNNNNNNNNNNNjNNNNNk                                                                 jH...V.....j...........V....lp..........
//   jH            lPP.....jNNP           Et. jNNNNNNNNNNNNgNNNNqCj                                                                  Jp...Jp....t............C....t.......y
//   B              g.     JC             B   KNNNNNNNNNNNNjNNNj. j                      ....wwsPPYYvw..                            .g......Q....L............l.....p..ppC
//  jh            KNN.                    B   NNNNNjNNNNNNNjNNy   L                ..cP..................V                          ....... .hp...p.............W....VP.
//   Jp           .NNNNNNNNNNNN          jC  jNNNNNNNNNNNNNNNq.   f              ge......................jO                              .gNNgNp..j..............lp...pqu..
//    jC                                 g    NNNNqNNNNNNNNNNi     p            Jp.......................h                     .KNNNNNNbNNjNNNNNp.jNp..............p..jNpNP
//     K                                 N    gNNNNpNNNNNNNNNL      L.           .W....................P.                   .yQNNNNNNNjNCFNNNNNNN.jNNp...jp.........p..H
//     jE                               jC     pNNCJpNNNNNNNNNC       v.            .Yc............                      .vE..KNNggNbNdy jNNgpNNNpjNppb...y.........Hp.H
//      g                               j.      NNL  QNNNNNNNpNC        .w.                                           .........JpNgNNNNNgjNNNNNNNbgNNNNN..j........f tj.
//      K.                              j.             VhNNNNNpNk           .v..                                ..aC..........jNNNNNNNjNNNNNNNNNNHNNNNNNb.jH......j.  .
//      lNNNNNwpp.                      lC               .YqpNNpNN.             fZw...                    ..ypN............yNgNNNNNNyNNNNNNNNNNNNNNNNNNNNkjH.....j.
//                 .YWp....ypmmmNNNNNNNmmN                    .Y.Yph.          A..JCf....Yy..........ypNNNNNO..........jNbNNNNNNNNjNNNNNNNNNNNNNNNNNNNNNNNj.....gNNb
//                                                                  YQy       .     bjb.pNNNNNNNyNNqNNNNQ.........pmPNNNNNNNNNNNqNNNNNNNNNNNNNNNNNNNNNNNNNO...gNNNNNE
//                                                                                .ANNNNgPjNNqNNNNNNgppNNjppmNNgNNNNNNNNNNNNNNNyNNNNNNNNNNNNNNNNNNNNNNNNNOjgNNNNNNNNNC

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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int h,w;
    cin >> h >> w;
    string s[310];
    vector<vector<int>> a(610,vector<int>(610,0)),b(610,vector<int>(610,0));
    for (int i = 0;i < h;++i) cin >> s[i];
    for (int i = 0;i < h;++i) for (int j = 0;j < w;++j) if (s[i][j] == '#') {
        a[i+j][i-j+w+1]++;
        b[i+j+1][i-j+w]++;
    }
    for (int i = 0;i < 600;++i) for (int j = 0;j < 600;++j) a[i][j+1] += a[i][j];
    for (int i = 0;i < 600;++i) for (int j = 0;j < 600;++j) b[i+1][j] += b[i][j];
    ll ans = 0;
    for (int i = 0;i < h+w;++i) {
        for (int j = -w+1;j < h;++j) {
            int x1 = (i+j)/2,y1 = (i-j)/2;
            if ((i+j)&1 || x1 < 0 || x1 >= h || y1 < 0 || y1 >= w || s[x1][y1] != '#') continue;
            for (int k = j+1;k < h;++k) {
                int x2 = (i+k)/2,y2 = (i-k)/2;
                if ((i+k)&1 || x2 < 0 || x2 >= h || y2 < 0 || y2 >= w || s[x2][y2] != '#') continue;
                if (i-(k-j) >= 0) ans += a[i-k+j][k+w+1]-a[i-k+j][j+w];
                if (i+k-j < h+w) ans += a[i+k-j][k+w+1]-a[i+k-j][j+w];
            }
        }
    }
    for (int i = -w+1;i < h;++i) {
        for (int j = 0;j < h+w;++j) {
            int x1 = (i+j)/2,y1 = (-i+j)/2;
            if ((i+j)&1 || x1 < 0 || x1 >= h || y1 < 0 || y1 >= w || s[x1][y1] != '#') continue;
            for (int k = j+1;k < h+w;++k) {
                int x2 = (i+k)/2,y2 = (-i+k)/2;
                if ((i+k)&1 || x2 < 0 || x2 >= h || y2 < 0 || y2 >= w || s[x2][y2] != '#') continue;
                if (i-(k-j)+w >= 0) ans += b[k][i-k+j+w]-b[j+1][i-k+j+w];
                if (i+k-j < h) ans += b[k][i+k-j+w]-b[j+1][i+k-j+w];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328