#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template <class T> vector<T> make_v(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto make_v(size_t N,T... t){return vector<decltype(make_v(t...))>(N,make_v(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

template<class T> class BinaryIndexedTree2DRangeSumQuery{
public:
    const int N,M;
    vector<vector<T>> bit;
 
    //1-indexed
    BinaryIndexedTree2DRangeSumQuery(const int& N,const int& M):N(N),M(M),bit(N+1,vector<T>(M+1,0)){
        // do nothing
    }
 
    T getvar(const int& i,const int& j){
        long long val = 0;
        for(int y=i;y>0;y-=(y&-y)) for(int x=j;x>0;x-=(x&-x)) {
            val += bit[y][x];
        }
        return val;
    }
 
    // [x1,x2] * [y1,y2] 0-indexed かつ 閉区間
    T getvar(int y1,int x1,int y2,int x2){
		++y1,++x1,++y2,++x2;
        T res = getvar(y1-1,x1-1);
        res -= getvar(y1-1,x2);
        res -= getvar(y2,x1-1);
        res += getvar(y2,x2);
        return res;
    }
 
    //add 0-indexed
    void update(int i,int j,const T& val){
		++i,++j;
        if(i==0||j==0) return;
        for(int y=i;y<=N;y+=(y&-y)) for(int x=j;x<=M;x+=(x&-x)) {
            bit[y][x]+=val;
        }
    }
 
};

int main() {
	int H,W; cin >> H >> W;
	vector<string> S(H);
	for(int i = 0; i < H; ++i) cin >> S[i];

	vector<vector<int>> a(H,vector<int>(W,0)),b(H,vector<int>(W,0));

	queue<pair<int,int>> q;
	q.push({0,0});
	a[0][0] = 0;
	while(q.size()){
		int y = q.front().first;
		int x = q.front().second;
		q.pop();
		if(y+1<H&&!a[y+1][x]){
			a[y+1][x] = a[y][x] + 1;
			q.push({y+1,x});
		}
		if(x+1<W&&!a[y][x+1]){
			a[y][x+1] = a[y][x] + 1;
			q.push({y,x+1});
		}
	}
	q.push({H-1,0});
	a[H-1][0] = 0;
	while(q.size()){
		int y = q.front().first;
		int x = q.front().second;
		q.pop();
		if(0<=y-1&&!b[y-1][x]){
			b[y-1][x] = b[y][x] + 1;
			q.push({y-1,x});
		}
		if(x+1<W&&!b[y][x+1]){
			b[y][x+1] = b[y][x] + 1;
			q.push({y,x+1});
		}
	}
	vector<BinaryIndexedTree2DRangeSumQuery<int>> vbita(H+W,BinaryIndexedTree2DRangeSumQuery<int>(H,W));
	vector<BinaryIndexedTree2DRangeSumQuery<int>> vbitb(H+W,BinaryIndexedTree2DRangeSumQuery<int>(H,W));
	for(int i = 0; i < H; ++i){
		for(int j = 0; j < W; ++j){
			if(S[i][j]=='#') {
				vbita[a[i][j]].update(i,j,1);
				vbitb[b[i][j]].update(i,j,1);
			}
		}
	}

	int M = max(H,W);
	ll ans = 0;
	for(int i = 0; i < H; ++i){
		for(int j = 0; j < W; ++j){
			for(int k = 1; k < M; ++k) {
				if(i+k<H&&S[i+k][j]=='#' &&j+k<W &&S[i][j+k]=='#'&&0<=a[i][j]-k ) ans += vbita[a[i][j]-k].getvar(0,0,i,j);
				if(i+k<H&&S[i+k][j]=='#' &&0<=j-k&&S[i][j-k]=='#'&&b[i][j]+k<H+W) ans += vbitb[b[i][j]+k].getvar(0,j,i,W-1);
				if(0<=i-k&&S[i-k][j]=='#'&&j+k<W &&S[i][j+k]=='#'&&0<=b[i][j]-k ) ans += vbitb[b[i][j]-k].getvar(H-1,0,i,j);
				if(0<=i-k&&S[i-k][j]=='#'&&0<=j-k&&S[i][j-k]=='#'&&a[i][j]+k<H+W) ans += vbita[a[i][j]+k].getvar(i,j,H-1,W-1);
			}
		}
	}
	cout << ans << endl;
	
    return 0;
}
