// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
// }}}
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;


// #undef DEBUG
// #define DEBUG
// DEBUG {{{
#include <stack>
#include <tuple>
#include <valarray>
#include <vector>
// clang-format off
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":", ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream &o, tuple<T...> const &t){ o << "("; _ot<0>(o, t); o << ")"; return o; }
template<class T, class U> ostream & operator<<(ostream &o, pair<T, U> const &p) { o << "(" << p.first << ", " << p.second << ")"; return o; }
template < class T > ostream &operator<<(ostream &o, const stack<T> &a) { o << "{"; for(auto tmp = a; tmp.size(); tmp.pop()) o << (a.size() == tmp.size() ? "" : ", ") << tmp.top(); o << "}"; return o; }
#ifdef DEBUG
#if !defined(DEBUG_OUT)
#define DEBUG_OUT cerr
#endif
#if !defined(DEBUG_LEFT)
#define DEBUG_LEFT "\e[1;36m"
#endif
#if !defined(DEBUG_RIGHT)
#define DEBUG_RIGHT ":\e[m"
#endif
#define dump(...) [&](){auto __debug_tap=make_tuple(__VA_ARGS__);DEBUG_OUT<<DEBUG_LEFT<<__LINE__ << DEBUG_RIGHT << " " <<#__VA_ARGS__<<" = "<<__debug_tap<<endl;}()
template < class T > inline void dump2D(T &d, size_t sizey, size_t sizex) { for(size_t i = 0; i < sizey; i++) { DEBUG_OUT << "\t"; for(size_t j = 0; j < sizex; j++) DEBUG_OUT << d[i][j] << (j + 1 == sizex ? "" : "\t"); DEBUG_OUT << endl; } }
template < class T, class = typename iterator_traits< typename T::iterator >::value_type, class = typename enable_if<!is_same<T, string>::value>::type > ostream &operator<<(ostream &o, const T &a) { o << "{"; for(auto ite = a.begin(); ite != a.end(); ++ite) o << (ite == a.begin() ? "" : ", ") << *ite; o << "}"; return o; }
#else
#define dump(...) (42)
#define dump2D(...) (42)
template < class T, class = typename iterator_traits< typename T::iterator >::value_type, class = typename enable_if<!is_same<T, string>::value>::type > ostream &operator<<(ostream &o, const T &a) { for(auto ite = a.begin(); ite != a.end(); ++ite) o << (ite == a.begin() ? "" : " ") << *ite; return o; }
#endif
// clang-format on
// }}}



const int N = 300;
const int mod = 998244353;
int a[600][600];
ll b[600][600];
int h, w;
int n;
int get(int i, int j) {
  if(i < 0 || j < 0 || i >= n || j >= n) return 0;
  return a[i][j];
}
ll get(int i, int j, int k, int l) {
  // dump(i, j, k, l);
  if(i < 0) i = 0;
  if(j < 0) j = 0;
  // if(k < 0) k = 0;
  // if(l < 0) l = 0;
  // if(i >= w+h) i = w+h-1;
  // if(j >= w+h) j = w+h-1;
  if(k >= n) k = n-1;
  if(l >= n) l = n-1;
  if(i > k) return 0;
  if(j > l) return 0;
  // dump(i, j, k, l);
  ll res = b[k][l];
  if(i-1>=0) res -= b[i-1][l];
  if(j-1>=0) res -= b[k][j-1];
  if(i-1>=0 && j-1>=0) res += b[i-1][j-1];
  // dump(res);
  return res;
}
int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  cin >> h >> w;
  for(int i = 0; i < h; i++) { // ok
    string s;
    cin >> s;
    for(int j = 0; j < w; j++) a[i+j][h - 1 - i + j] = s[j] == '#' ? 1 : 0, b[i+j][h-1-i+j]=a[i+j][h-1-i+j];
  }
  dump2D(a, w+h, w+h);
  n = max(h, w) * 2;
  for(int i = 1; i < n; i++) for(int j = 0; j < n; j++) b[i][j] += b[i-1][j];
  for(int i = 0; i < n; i++) for(int j = 1; j < n; j++) b[i][j] += b[i][j-1];
  // dump("====");
  // dump2D(b, n, n);
  ll ans = 0;
  int cnt = 0;
  for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(a[i][j]) {
    cnt++;
    for(int k = 1; k <= n; k++) {
      ll f[4] = {get(i+k, j), get(i, j+k), get(i-k, j), get(i, j-k)};
      ll t[4] = {
        get(i, j-k, i+k, j-k) + get(i, j+k, i+k, j+k),
        get(i-k, j, i-k, j+k) + get(i+k, j, i+k, j+k),
        get(i-k, j-k, i, j-k) + get(i-k, j+k, i, j+k),
        get(i-k, j-k, i-k, j) + get(i+k, j-k, i+k, j),
      };
      if(f[0]+f[1]+f[2]+f[3]) {
        dump(i, j);
      dump(f[0], f[1], f[2], f[3]);
      dump(t[0], t[1], t[2], t[3]);
      }
      // ll t[4] = {
      //   get(i-k, j-k, i, j+k) - get(i-k+1, j-k+1, i, j+k-1) + get(i+k, j-k, i+k, j+k),
      //   get(i-k, j-k, i+k, j) - get(i-k+1, j-k+1, i+k-1, j) + get(i-k, j+k, i+k, j+k),
      //   get(i, j-k, i+k, j+k) - get(i, j-k+1, i+k-1, j+k-1) + get(i-k, j-k, i-k, j+k),
      //   get(i-k, j, i+k, j+k) - get(i-k+1, j, i+k-1, j+k-1) + get(i-k, j-k, i+k, j-k),
      // };
      for(int m = 0; m < 2; m++) if(f[m]) ans += t[m];
      for(int m = 0; m < 4; m++) if(f[m]*f[(m+1)%4]) ans--;
      // ans -= f[0] + f[1];
    }
  }
  dump(cnt);
  // dump(ans);
  cout << ans << endl;
  return 0;
}
// かなしい

Measured memory_bytes: 4480