#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;

typedef long long ll;
#define forn(i, n) for (int i = 0; i < n; i++)
#define form(i, n, m) for (int i = n; i <= m; i++)
#define mp make_pair
#define pub push_back
#define XX first
#define YY second
#define db long double
#define all(a) a.begin(), a.end()
#define y1 dsfgsdfgsdfgsdfgsdfgsdfg
#define y0 asdfasdf3rcdt234d5c23xd234dx43
const string LN = "\n";
const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = (int)2e9 + 7;
const ll LINF = (ll)9e18 + 7;

const ll P = 353251;
const ll P1 = 353251;
const ll P2 = 239017;
const ll MOD = 1e9 + 7;
const ll MOD1 = 1e9 + 7;
const ll MOD2 = 1e9 + 9;

//
/*
const int MAX_MEM = 1e8;
int mpos = 0;
char mem[MAX_MEM];
void * operator new ( size_t n ) {
    char *res = mem + mpos;
    mpos += n;
    return (void *)res;
}
void operator delete ( void * ) { }
*/
//

int n, m;
char a[2007][2007];
ll ans = 0;
int pref[2007][2007];
int pref2[2007][2007];
int rr[2007][2007];
int le[2007][2007];
bool was[2007][2007];

int get(int x1, int y1, int x2, int y2) {
	if (x1 > x2 || y1 > y2)
		return 0;
	return pref[x2][y2] - pref[x1 - 1][y2] - pref[x2][y1 - 1] + pref[x1 - 1][y1 - 1];
}

int get2(int x1, int y1, int x2, int y2) {
	if (x1 > x2 || y1 > y2)
		return 0;
	return pref2[x2][y2] - pref2[x1 - 1][y2] - pref2[x2][y1 - 1] + pref2[x1 - 1][y1 - 1];
}

const bool is_testing = 0;
int main() {
	srand('D' + 'E' + 'N' + 'I' + 'S' + 'S' + 'O' + 'N');
	ios_base::sync_with_stdio(0); cin.tie(0);
	if (is_testing) {
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	} else {
		//freopen("input.txt", "r", stdin);
		//freopen("output.txt", "w", stdout);
	}
	cin >> n >> m;
	forn(i, n) {
		forn(j, m) {
			cin >> a[i + 1][j + 1];
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			pref[i][j] = (a[i][j] == '#') + pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1];
		}
	}
	// 0
	for (int i = 2; i < n; i++) {
		if (get(i, 1, i, m) == 0)
			ans++;
	}
	for (int i = 2; i < m; i++) {
		if (get(1, i, n, i) == 0)
			ans++;
	}
	// 1
	for (int i = 2; i < n; i++) {
		for (int j = 2; j < m; j++) {
			int q1 = get(1, j, i, j);
			int q2 = get(i, j, i, m);
			int q3 = get(i, j, n, j);
			int q4 = get(i, 1, i, j);
			if (!q1 && !q2)
				ans++;
			if (!q2 && !q3)
				ans++;
			if (!q3 && !q4)
				ans++;
			if (!q4 && !q1)
				ans++;
		}
	}
	// 2
	// |_|
	///1
	for (int i = 2; i < n; i++) {
		int last = -1;
		for (int j = m - 1; j >= 2; j--) {
			if (a[i][j] == '.') {
				if (last == -1)
					last = j;
				rr[i][j] = last;
			} else
				last = -1;
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			was[i][j] = 0;
			if (get(1, j, i, j) == 0)
				was[i][j] = 1;
			pref2[i][j] = was[i][j] + pref2[i - 1][j] + pref2[i][j - 1] - pref2[i - 1][j - 1];
		}
	}
	for (int i = 2; i < n; i++) {
		for (int j = 2; j < m; j++) {
			if (get(1, j, i, j) != 0)
				continue;
			int r = rr[i][j];
			ans += get2(i, j + 2, i, r);
		}
	}
	///2
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			was[i][j] = 0;
			if (get(i, j, n, j) == 0)
				was[i][j] = 1;
			pref2[i][j] = was[i][j] + pref2[i - 1][j] + pref2[i][j - 1] - pref2[i - 1][j - 1];
		}
	}
	for (int i = 2; i < n; i++) {
		for (int j = 2; j < m; j++) {
			if (get(i, j, n, j) != 0)
				continue;
			int r = rr[i][j];
			ans += get2(i, j + 2, i, r);
		}
	}
	///3
	for (int j = 2; j < m; j++) {
		int last = -1;
		for (int i = n - 1; i >= 2; i--) {
			if (a[i][j] != '#') {
				if (last == -1)
					last = i;
				rr[i][j] = last;
			} else {
				last = -1;
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++){
			was[i][j] = 0;
			if (get(i, 1, i, j) == 0)
				was[i][j] = 1;
			pref2[i][j] = was[i][j] + pref2[i - 1][j] + pref2[i][j - 1] - pref2[i - 1][j - 1];
		}
	}
	for (int i = 2; i < n; i++) {
		for (int j = 2; j < m; j++) {
			if (get(i, 1, i, j) != 0)
				continue;
			int r = rr[i][j];
			ans += get2(i + 2, j, r, j);
		}
	}
	///4
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++){
			was[i][j] = 0;
			if (get(i, j, i, m) == 0)
				was[i][j] = 1;
			pref2[i][j] = was[i][j] + pref2[i - 1][j] + pref2[i][j - 1] - pref2[i - 1][j - 1];
		}
	}
	for (int i = 2; i < n; i++) {
		for (int j = 2; j < m; j++) {
			if (get(i, j, i, m) != 0)
				continue;
			int r = rr[i][j];
			ans += get2(i + 2, j, r, j);
		}
	}
	// |_
	//   |
	for (int i = 2; i < n; i++) {
		int last = -1;
		for (int j = 2; j < m; j++) {
			if (a[i][j] == '.') {
				if (last == -1)
					last = j;
				le[i][j] = last;
			} else {
				last = -1;
			}
		}
		last = -1;
		for (int j = m - 1; j >= 2; j--) {
			if (a[i][j] == '.') {
				if (last == -1)
					last = j;
				rr[i][j] = last;
			} else {
				last = -1;
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			was[i][j] = 0;
			if (get(i, j, n, j) == 0)
				was[i][j] = 1;
			pref2[i][j] = was[i][j] + pref2[i - 1][j] + pref2[i][j - 1] - pref2[i - 1][j - 1];
		}
	}
	for (int i = 2; i < n; i++) {
		for (int j = 2; j < m; j++) {
			if (get(1, j, i, j) != 0)
				continue;
			int l1 = le[i][j];
			int r1 = rr[i][j];
			ans += get2(i, j + 1, i, r1);
			ans += get2(i, l1, i, j - 1);
		}
	}
	// _
	//  |_
	for (int j = 2; j < m; j++) {
		int last = -1;
		for (int i = 2; i < n; i++) {
			if (a[i][j] == '.') {
				if (last == -1)
					last = i;
				le[i][j] = last;
			} else {
				last = -1;
			}
		}
		last = -1;
		for (int i = n - 1; i >= 2; i--) {
			if (a[i][j] == '.') {
				if (last == -1)
					last = i;
				rr[i][j] = last;
			} else {
				last = -1;
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			was[i][j] = 0;
			if (get(i, j, i, m) == 0)
				was[i][j] = 1;
			pref2[i][j] = was[i][j] + pref2[i - 1][j] + pref2[i][j - 1] - pref2[i - 1][j - 1];
		}
	}
	for (int i = 2; i < n; i++) {
		for (int j = 2; j < m; j++) {
			if (get(i, 1, i, j) != 0)
				continue;
			int l1 = le[i][j];
			int r1 = rr[i][j];
			ans += get2(i + 1, j, r1, j);
			ans += get2(l1, j, i - 1, j);
		}
	}
	//
	cout << ans;
}


//#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
//#include <unordered_map>
//#include <unordered_set>
using namespace std;

typedef long long ll;
#define eps 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 1LL<<60
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define DE(val) cout<<#val<<": "<<val<<endl;

const int dx4[5] = { 0,-1,0,1,0 };
const int dy4[5] = { 0,0,1,0,-1 };
const int dx8[9] = { 0,-1,0,1,0,1,1,-1,-1 };
const int dy8[9] = { 0,0,1,0,-1,1,-1,1,-1 };
const int maxn = 2e3 + 5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }
void YES() { puts("YES"); exit(0); }
void Yes() { puts("Yes"); exit(0); }
void NO() { puts("NO"); exit(0); }
void No() { puts("No"); exit(0); }
void one() { puts("-1"); exit(0); }

int n, m;
char val[maxn][maxn];
int up[maxn][maxn], down[maxn][maxn];
int le[maxn][maxn], ri[maxn][maxn];

void solve()
{
	sa(n), sa(m);
	repp(i, 1, n)
	{
		scanf("%s", val[i] + 1);
	}
	repp(i, 1, n)
	{
		repp(j, 1, m)
		{
			if (val[i][j] == '#')
			{
				continue;
			}
			else
			{
				up[i][j] = up[i - 1][j] + 1;
				le[i][j] = le[i][j - 1] + 1;
			}
		}
	}
	for (int i = n; i >= 1; i--)
	{
		for (int j = m; j >= 1; j--)
		{
			if (val[i][j] == '#')
			{
				continue;
			}
			else
			{
				down[i][j] = down[i + 1][j] + 1;
				ri[i][j] = ri[i][j + 1] + 1;
			}
		}
	}

	ll res = 0;
	for (int i = 2; i<n; i++)
	{
		res += (le[i][m] >= m);
	}
	for (int i = 2; i<m; i++)
	{
		res += (up[n][i] >= n);
	}

	for (int i = 2; i<n; i++)
	{
		for (int j = 2; j<m; j++)
		{
			int x = 0;
			int y = 0;
			x += le[i][j] >= j;
			x += ri[i][j] >= (m - j + 1);
			y += up[i][j] >= i;
			y += down[i][j] >= (n - i + 1);
			res += x*y;
		}
	}

	for (int i = 2; i<n; i++)
	{
		int x1 = 0;
		int x2 = 0;
		for (int j = 2; j<m; j++)
		{
			if (val[i][j] == '#')
			{
				x1 = 0;
				x2 = 0;
			}
			else
			{
				if (j > 2)
				{
					x2 += up[i][j - 1] >= i;
				}
				res += x1*(up[i][j] >= i);
				res += x2*(down[i][j] >= (n - i + 1));
				if (j > 2)
				{
					x1 += up[i][j - 1] >= i;
				}
			}
		}
	}
	for (int i = 2; i<n; i++)
	{
		int x1 = 0;
		int x2 = 0;
		for (int j = 2; j<m; j++)
		{
			if (val[i][j] == '#')
			{
				x1 = 0;
				x2 = 0;
			}
			else
			{
				if (j > 2)
				{
					x2 += down[i][j - 1] >= (n - i + 1);
				}
				res += x2*(up[i][j] >= i);
				res += x1*(down[i][j] >= (n - i + 1));
				if (j > 2)
				{
					x1 += down[i][j - 1] >= (n - i + 1);
				}
			}
		}
	}

	for (int i = 2; i<m; i++)
	{
		int x1 = 0;
		int x2 = 0;
		for (int j = 2; j<n; j++)
		{
			if (val[j][i] == '#')
			{
				x1 = 0;
				x2 = 0;
			}
			else
			{
				if (j > 2)
				{
					x2 += le[j - 1][i] >= i;
				}
				res += x2*(ri[j][i] >= (m - i + 1));
				res += x1*(le[j][i] >= i);
				if (j > 2)
				{
					x1 += le[j - 1][i] >= i;
				}
			}
		}
	}
	for (int i = 2; i<m; i++)
	{
		int x1 = 0;
		int x2 = 0;
		for (int j = 2; j<n; j++)
		{
			if (val[j][i] == '#')
			{
				x1 = 0;
				x2 = 0;
			}
			else
			{
				if (j > 2)
				{
					x2 += ri[j - 1][i] >= (m - i + 1);
				}
				res += x1*(ri[j][i] >= (m - i + 1));
				res += x2*(le[j][i] >= i);
				if (j > 2)
				{
					x1 += ri[j - 1][i] >= (m - i + 1);
				}
			}
		}
	}

	printf("%lld\n", res);
}

int main()
{

	solve();
	//system("pause");
	return 0;
}


//#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
//#include <unordered_map>
//#include <unordered_set>
using namespace std;

typedef long long ll;
#define eps 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 1LL<<60
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define DE(val) cout<<#val<<": "<<val<<endl;

const int dx4[5] = { 0,-1,0,1,0 };
const int dy4[5] = { 0,0,1,0,-1 };
const int dx8[9] = { 0,-1,0,1,0,1,1,-1,-1 };
const int dy8[9] = { 0,0,1,0,-1,1,-1,1,-1 };
const int maxn = 2e3 + 5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }
void YES() { puts("YES"); exit(0); }
void Yes() { puts("Yes"); exit(0); }
void NO() { puts("NO"); exit(0); }
void No() { puts("No"); exit(0); }
void one() { puts("-1"); exit(0); }

int n, m;
char val[maxn][maxn];
int up[maxn][maxn], down[maxn][maxn];
int le[maxn][maxn], ri[maxn][maxn];

void solve()
{
	sa(n), sa(m);
	repp(i, 1, n)
	{
		scanf("%s", val[i] + 1);
	}
	repp(i, 1, n)
	{
		repp(j, 1, m)
		{
			if (val[i][j] == '#')
			{
				continue;
			}
			else
			{
				up[i][j] = up[i - 1][j] + 1;
				le[i][j] = le[i][j - 1] + 1;
			}
		}
	}
	for (int i = n; i >= 1; i--)
	{
		for (int j = m; j >= 1; j--)
		{
			if (val[i][j] == '#')
			{
				continue;
			}
			else
			{
				down[i][j] = down[i + 1][j] + 1;
				ri[i][j] = ri[i][j + 1] + 1;
			}
		}
	}

	ll res = 0;
	for (int i = 2; i<n; i++)
	{
		res += (le[i][m] >= m);
	}
	for (int i = 2; i<m; i++)
	{
		res += (up[n][i] >= n);
	}

	for (int i = 2; i<n; i++)
	{
		for (int j = 2; j<m; j++)
		{
			int x = 0;
			int y = 0;
			x += le[i][j] >= j;
			x += ri[i][j] >= (m - j + 1);
			y += up[i][j] >= i;
			y += down[i][j] >= (n - i + 1);
			res += x*y;
		}
	}

	for (int i = 2; i<n; i++)
	{
		int x1 = 0;
		int x2 = 0;
		for (int j = 2; j<m; j++)
		{
			if (val[i][j] == '#')
			{
				x1 = 0;
				x2 = 0;
			}
			else
			{
				if (j > 2)
				{
					x2 += up[i][j - 1] >= i;
				}
				res += x1*(up[i][j] >= i);
				res += x2*(down[i][j] >= (n - i + 1));
				if (j > 2)
				{
					x1 += up[i][j - 1] >= i;
				}
			}
		}
	}
	for (int i = 2; i<n; i++)
	{
		int x1 = 0;
		int x2 = 0;
		for (int j = 2; j<m; j++)
		{
			if (val[i][j] == '#')
			{
				x1 = 0;
				x2 = 0;
			}
			else
			{
				if (j > 2)
				{
					x2 += down[i][j - 1] >= (n - i + 1);
				}
				res += x2*(up[i][j] >= i);
				res += x1*(down[i][j] >= (n - i + 1));
				if (j > 2)
				{
					x1 += down[i][j - 1] >= (n - i + 1);
				}
			}
		}
	}

	for (int i = 2; i<m; i++)
	{
		int x1 = 0;
		int x2 = 0;
		for (int j = 2; j<n; j++)
		{
			if (val[i][j] == '#')
			{
				x1 = 0;
				x2 = 0;
			}
			else
			{
				if (i > 2)
				{
					x2 += le[i - 1][j] >= j;
				}
				res += x2*(ri[i][j] >= (m - j + 1));
				res += x1*(le[i][j] >= j);
				if (i>2)
				{
					x1 += le[i - 1][j] >= j;
				}
			}
		}
	}
	for (int i = 2; i<m; i++)
	{
		int x1 = 0;
		int x2 = 0;
		for (int j = 2; j<n; j++)
		{
			if (val[i][j] == '#')
			{
				x1 = 0;
				x2 = 0;
			}
			else
			{
				if (i > 2)
				{
					x2 += ri[i - 1][j] >= (m - j + 1);
				}
				res += x1*(ri[i][j] >= (m - j + 1));
				res += x2*(le[i][j] >= j);
				if (i>2)
				{
					x1 += ri[i - 1][j] >= (m - j + 1);
				}
			}
		}
	}

	printf("%lld\n", res);
}

int main()
{

	solve();
	//system("pause");
	return 0;
}


#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007

using namespace std;

typedef long long ll;

int n, m;

char a[2002][2002], b[2002][2002];

bool oki[2002][2002], oki2[2002][2002];

int sumgg[2002][2002], sumgg2[2002][2002];

int prf[2002][2002];

vector<int> pzbd[2002];

ll solve2()
{
    ll sol2 = 0;
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j)
        {
            sumgg[i][j] = sumgg[i][j-1] + oki[i][j];
            sumgg2[i][j] = sumgg2[i][j-1] + oki2[i][j];
            prf[i][j] = prf[i][j-1] + (a[i][j] == '#');
            if(a[i][j] == '#')
                pzbd[i].pb(j);
        }
    for(int startcol = 2; startcol < m; ++startcol)
    {
        for(int j = 1; j < n; ++j)
        {
            if(a[j][startcol] == '#')
                break;
            if(j >= 2)
            {
                int va = prf[j][startcol];
                int st = startcol;
                int dr = m-1;
                int anss = startcol;
                if(va == prf[j][m-1])
                    anss = m-1;
                else
                    anss = pzbd[j][va];
                if(anss >= startcol + 2)
                    sol2 += sumgg2[j][anss] - sumgg2[j][startcol + 1];
                if(anss >= startcol + 1)
                    sol2 += sumgg[j][anss] - sumgg[j][startcol];
            }
            if(j >= 2)
            {
                int va = prf[j][startcol];
                int st = 2;
                int dr = startcol;
                int anss = startcol;
                if(va == prf[j][2])
                    anss = 2;
                else
                    anss = pzbd[j][va - 1];
                if(anss <= startcol - 2)
                    sol2 += sumgg2[j][startcol - 2] - sumgg2[j][anss - 1];
                if(anss <= startcol - 1)
                    sol2 += sumgg[j][startcol - 1] - sumgg[j][anss - 1];
            }
        }
        for(int j = n; j >= 2; --j)
        {
            if(a[j][startcol] == '#')
                break;
            if(j <= n-1)
            {
                int va = prf[j][startcol];
                int st = startcol;
                int dr = m-1;
                int anss = startcol;
                if(va == prf[j][m-1])
                    anss = m-1;
                else
                    anss = pzbd[j][va];
                if(anss >= startcol + 2)
                    sol2 += sumgg[j][anss] - sumgg[j][startcol + 1];
                if(anss >= startcol + 1)
                    sol2 += sumgg2[j][anss] - sumgg2[j][startcol];
            }
            if(j <= n-1)
            {
                int va = prf[j][startcol];
                int st = 2;
                int dr = startcol;
                int anss = startcol;
                if(va == prf[j][2])
                    anss = 2;
                else
                    anss = pzbd[j][va - 1];
                if(anss <= startcol - 2)
                    sol2 += sumgg[j][startcol - 2] - sumgg[j][anss - 1];
                if(anss <= startcol - 1)
                    sol2 += sumgg2[j][startcol - 1] - sumgg2[j][anss - 1];
            }
        }
    }
    return sol2;
}
ll solve()
{
    ll sol = 0;
    // 0 turns
    for(int i = 2; i < n; ++i)
    {
        bool ok = 1;
        for(int j = 1; j <= m; ++j)
            if(a[i][j] == '#')
                ok = 0;
        sol += ok;
    }
    for(int i = 2; i < m; ++i)
    {
        bool ok = 1;
        for(int j = 1; j <= n; ++j)
            if(a[j][i] == '#')
                ok = 0;
        sol += ok;
    }
    // 1 turn
    for(int i = n; i >= 1; --i)
        for(int j = m; j >= 1; --j)
            if(a[i][j] == '.')
            {
                if(i == n)
                    oki[i][j] = 1;
                else
                    oki[i][j] |= oki[i+1][j];
            }
            else
                oki[i][j] = 0;
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j)
            if(a[i][j] == '.')
            {
                if(i == 1)
                    oki2[i][j] = 1;
                else
                    oki2[i][j] |= oki2[i-1][j];
            }
            else
                oki2[i][j] = 0;
    for(int i = 2; i < n; ++i)
    {
        for(int j = 1; j < m; ++j)
        {
            if(a[i][j] == '#')
                break;
            if(j >= 2)
                sol += oki[i][j], sol += oki2[i][j];
        }
        for(int j = m; j > 1; --j)
        {
            if(a[i][j] == '#')
                break;
            if(j <= m-1)
                sol += oki[i][j], sol += oki2[i][j];
        }
    }
    ll sol2 = solve2();
    // 2 turns
    for(int i = 1; i <= n; ++i)
        pzbd[i].clear();
    for(int i = 1; i <= m; ++i)
        for(int j = 1; j <= n; ++j)
            b[i][j] = a[j][i];
    swap(n, m);
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j)
            a[i][j] = b[i][j];
    memset(oki, 0, sizeof(oki));
    memset(oki2, 0, sizeof(oki2));
    memset(sumgg, 0, sizeof(sumgg));
    memset(sumgg2, 0, sizeof(sumgg2));
    memset(prf, 0, sizeof(prf));
    for(int i = n; i >= 1; --i)
        for(int j = m; j >= 1; --j)
            if(a[i][j] == '.')
            {
                if(i == n)
                    oki[i][j] = 1;
                else
                    oki[i][j] |= oki[i+1][j];
            }
            else
                oki[i][j] = 0;
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j)
            if(a[i][j] == '.')
            {
                if(i == 1)
                    oki2[i][j] = 1;
                else
                    oki2[i][j] |= oki2[i-1][j];
            }
            else
                oki2[i][j] = 0;
    sol2 += solve2();
    sol += sol2 / 2;
    return sol;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    for(int i = 1; i <= n; ++i)
        cin >> (a[i] + 1);
    cout << solve();
    return 0;
}


import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Nipuna Samarasekara
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		FastPrinter out = new FastPrinter(outputStream);
		TaskF solver = new TaskF();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskF {
    // 689^*(
    public void solve(int testNumber, FastScanner in, FastPrinter out) {
    int m=in.nextInt(),n=in.nextInt();
    boolean[][] board= new boolean[m][n];
        for (int i = 0; i < m; i++) {
            String s=in.next();
            for (int j = 0; j < n; j++) {
                if (s.charAt(j)=='.') board[i][j]=true;
            }
        }
        boolean[][] u= new boolean[m][n];
        boolean[][] d= new boolean[m][n];
        boolean[][] l= new boolean[m][n];
        boolean[][] r= new boolean[m][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m ; j++) {
              if (board[j][i])u[j][i]=true;
                else break;
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = m-1; j >= 0 ; j--) {
                if (board[j][i])d[j][i]=true;
                else break;
            }
        }
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (board[i][j]) l[i][j]=true;
                else break;
            }
        }
          for (int i = 0; i < m; i++) {
            for (int j = n-1; j >=0; j--) {
                if (board[i][j]) r[i][j]=true;
                else break;
            }
        }

        long count=0;
        //no bends
        for (int i = 1; i < m-1; i++) {
            if (l[i][n-1])count++;
        }
        for (int i = 1; i < n-1; i++) {
            if (u[m-1][i])count++;
        }
     //   System.out.println(count);
        // one bend
        for (int i = 1; i < m-1; i++) {
            for (int j = 1; j < n-1; j++) {
                if (u[i][j]&&l[i][j])count++;
                if (u[i][j]&&r[i][j])count++;
                if (d[i][j]&&l[i][j])count++;
                if (d[i][j]&&r[i][j])count++;

            }
        }
      //  System.out.println(count);        // two bends
        for (int col = 1; col < n-1; col++) {
          int row=1;
          while (row<m-1){
            while (row<m-1&&!board[row][col])row++;
            long lc=0,rc=0,lrc=0,llc=0,rrc=0;
            while (row<m-1&&board[row][col]){
                if (l[row][col])lc++;
                if (r[row][col])rc++;
                if (l[row][col]&&r[row][col])lrc++;
                if (row>1&&board[row-1][col]){
                    if (l[row][col]&&(l[row-1][col]))llc++;
                    if (r[row][col]&&(r[row-1][col]))rrc++;
                }
                row++;
            }
           count+=lc*rc-lrc+lc*(lc-1)/2+rc*(rc-1)/2-llc-rrc;
          }
        }

         for (int row = 1; row < m-1; row++) {
          int col=1;
          while (col<n-1){
            while (col<n-1&&!board[row][col])col++;
            long lc=0,rc=0,lrc=0,llc=0,rrc=0;
            while (col<n-1&&board[row][col]){
                if (u[row][col])lc++;
                if (d[row][col])rc++;
                if (u[row][col]&&d[row][col])lrc++;
                if (col>1&&board[row][col-1]){
                    if (u[row][col]&&(u[row][col-1]))llc++;
                    if (d[row][col]&&(d[row][col-1]))rrc++;
                }

                col++;
            }
           count+=lc*rc-lrc+lc*(lc-1)/2+rc*(rc-1)/2-llc-rrc;
          }
        }

        out.println(count);
    }
}

class FastScanner extends BufferedReader {

    public FastScanner(InputStream is) {
        super(new InputStreamReader(is));
    }

    public int read() {
        try {
            int ret = super.read();
//            if (isEOF && ret < 0) {
//                throw new InputMismatchException();
//            }
//            isEOF = ret == -1;
            return ret;
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    public String next() {
        StringBuilder sb = new StringBuilder();
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        if (c < 0) {
            return null;
        }
        while (c >= 0 && !isWhiteSpace(c)) {
            sb.appendCodePoint(c);
            c = read();
        }
        return sb.toString();
    }

    static boolean isWhiteSpace(int c) {
        return c >= 0 && c <= 32;
    }

    public int nextInt() {
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int ret = 0;
        while (c >= 0 && !isWhiteSpace(c)) {
            if (c < '0' || c > '9') {
                throw new NumberFormatException("digit expected " + (char) c
                        + " found");
            }
            ret = ret * 10 + c - '0';
            c = read();
        }
        return ret * sgn;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }

}

class FastPrinter extends PrintWriter {

    public FastPrinter(OutputStream out) {
        super(out);
    }

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class F {

    static StringTokenizer st;
    static BufferedReader br;
    static PrintWriter pw;
    static int[][]cnt;
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int m = nextInt();
        char[][]a = new char[n+1][m+1];
        cnt = new int[n+1][m+1];
        for (int i = 1; i <= n; i++) {
            String s = next();
            for (int j = 1; j <= m; j++) {
                a[i][j] = s.charAt(j-1);
            }
        }
        for (int i = 1; i <= n; i++) {
            int s = 0;
            for (int j = 1; j <= m; j++) {
                if (a[i][j]=='#')
                    s++;
                cnt[i][j] = s + cnt[i-1][j];
            }
        }
        long ans = 0;
        int[]L1 = new int[n+2], R1 = new int[n+2];
        int[]L2 = new int[n+2], R2 = new int[n+2];
        for (int j = 2; j < m; j++) {
            Arrays.fill(L1, 0);
            Arrays.fill(R1, 0);
            Arrays.fill(L2, 0);
            Arrays.fill(R2, 0);
            for (int i = 2; i < n; i++) {
                if (a[i][j] != '.') {
                    L1[i] = 0;
                    R1[i] = 0;
                }
                else {
                    L1[i] = L1[i-1];
                    R1[i] = R1[i-1];
                }
                if (count(i, 1, i, j)==0)
                    L1[i]++;
                if (count(i, j, i, m)==0)
                    R1[i]++;
            }
            for (int i = n-1; i >= 2; i--) {
                if (a[i][j]!='.') {
                    L2[i] = 0;
                    R2[i] = 0;
                }
                else {
                    L2[i] = L2[i+1];
                    R2[i] = R2[i+1];
                }
                if (count(i, 1, i, j)==0)
                    L2[i]++;
                if (count(i, j, i, m)==0)
                    R2[i]++;
            }
            for (int i = 2; i <= n-1; i++) {
                if (count(i, 1, i, j)==0) {
                    ans += L2[i+2];
                    ans += R2[i+1];
                }
                if (count(i, j, i, m)==0) {
                    ans += R2[i+2];
                    ans += L2[i+1];
                }
            }
        }
        for (int i = 2; i < n; i++) {
            if (count(i, 1, i, m)==0)
                ans++;
        }
        int[]U1 = new int[m+2], D1 = new int[m+2];
        int[]U2 = new int[m+2], D2 = new int[m+2];
        for (int i = 2; i < n; i++) {
            Arrays.fill(U1, 0);
            Arrays.fill(D1, 0);
            Arrays.fill(U2, 0);
            Arrays.fill(D2, 0);
            for (int j = 2; j < m; j++) {
                if (a[i][j] != '.') {
                    U1[j] = 0;
                    D1[j] = 0;
                }
                else {
                    U1[j] = U1[j-1];
                    D1[j] = D1[j-1];
                }
                if (count(1, j, i, j)==0)
                    U1[j]++;
                if (count(i, j, n, j)==0)
                    D1[j]++;
            }
            for (int j = m-1; j >= 2; j--) {
                if (a[i][j] != '.') {
                    U2[j] = 0;
                    D2[j] = 0;
                }
                else {
                    U2[j] = U2[j+1];
                    D2[j] = D2[j+1];
                }
                if (count(1, j, i, j)==0)
                    U2[j]++;
                if (count(i, j, n, j)==0)
                    D2[j]++;
            }
            for (int j = 2; j <= m-1; j++) {
                if (count(1, j, i, j)==0) {
                    ans += U2[j+2];
                    ans += D2[j+1];
                }
                if (count(i, j, n, j)==0) {
                    ans += D2[j+2];
                    ans += U2[j+1];
                }
            }
        }
        for (int j = 2; j < m; j++) {
            if (count(1, j, n, j)==0)
                ans++;
        }
        for (int i = 2; i < n; i++) {
            for (int j = 2; j < m; j++) {
                if (count(1, j, i, j)==0 && count(i, 1, i, j)==0)
                    ans++;
                if (count(1, j, i, j)==0 && count(i, j, i, m)==0)
                    ans++;
                if (count(i, j, n, j)==0 && count(i, 1, i, j)==0)
                    ans++;
                if (count(i, j, n, j)==0 && count(i, j, i, m)==0)
                    ans++;
            }
        }
        System.out.println(ans);
        pw.close();
    }
    private static int count(int i1, int j1, int i2, int j2) {
        return cnt[i2][j2]-cnt[i1-1][j2]-cnt[i2][j1-1]+cnt[i1-1][j1-1];
    }
    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    private static String next() throws IOException {
        while (st==null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class F {

    static StringTokenizer st;
    static BufferedReader br;
    static PrintWriter pw;
    static int[][]cnt;
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int m = nextInt();
        char[][]a = new char[n+1][m+1];
        cnt = new int[n+1][m+1];
        for (int i = 1; i <= n; i++) {
            String s = next();
            for (int j = 1; j <= m; j++) {
                a[i][j] = s.charAt(j-1);
            }
        }
        for (int i = 1; i <= n; i++) {
            int s = 0;
            for (int j = 1; j <= m; j++) {
                if (a[i][j]=='#')
                    s++;
                cnt[i][j] = s + cnt[i-1][j];
            }
        }
        long ans = 0;
        int[]L2 = new int[n+2], R2 = new int[n+2];
        for (int j = 2; j < m; j++) {
            Arrays.fill(L2, 0);
            Arrays.fill(R2, 0);
            for (int i = n-1; i >= 2; i--) {
                if (a[i][j] != '.') {
                    L2[i] = 0;
                    R2[i] = 0;
                }
                else {
                    L2[i] = L2[i+1];
                    R2[i] = R2[i+1];
                }
                if (count(i, 1, i, j)==0)
                    L2[i]++;
                if (count(i, j, i, m)==0)
                    R2[i]++;
            }
            for (int i = 2; i <= n-1; i++) {
                if (count(i, 1, i, j)==0) {
                    if (a[i+1][j]=='.')
                        ans += L2[i+2];
                    ans += R2[i+1];
                }
                if (count(i, j, i, m)==0) {
                    ans += R2[i+2];
                    ans += L2[i+1];
                }
            }
        }
        for (int i = 2; i < n; i++) {
            if (count(i, 1, i, m)==0)
                ans++;
        }
        int[]U2 = new int[m+2], D2 = new int[m+2];
        for (int i = 2; i < n; i++) {
            Arrays.fill(U2, 0);
            Arrays.fill(D2, 0);
            for (int j = m-1; j >= 2; j--) {
                if (a[i][j] != '.') {
                    U2[j] = 0;
                    D2[j] = 0;
                }
                else {
                    U2[j] = U2[j+1];
                    D2[j] = D2[j+1];
                }
                if (count(1, j, i, j)==0)
                    U2[j]++;
                if (count(i, j, n, j)==0)
                    D2[j]++;
            }
            for (int j = 2; j <= m-1; j++) {
                if (count(1, j, i, j)==0) {
                    if (a[i][j+1]=='.')
                        ans += U2[j+2];
                    ans += D2[j+1];
                }
                if (count(i, j, n, j)==0) {
                    ans += D2[j+2];
                    ans += U2[j+1];
                }
            }
        }
        for (int j = 2; j < m; j++) {
            if (count(1, j, n, j)==0)
                ans++;
        }
        for (int i = 2; i < n; i++) {
            for (int j = 2; j < m; j++) {
                if (count(1, j, i, j)==0 && count(i, 1, i, j)==0)
                    ans++;
                if (count(1, j, i, j)==0 && count(i, j, i, m)==0)
                    ans++;
                if (count(i, j, n, j)==0 && count(i, 1, i, j)==0)
                    ans++;
                if (count(i, j, n, j)==0 && count(i, j, i, m)==0)
                    ans++;
            }
        }
        System.out.println(ans);
        pw.close();
    }
    private static int count(int i1, int j1, int i2, int j2) {
        return cnt[i2][j2]-cnt[i1-1][j2]-cnt[i2][j1-1]+cnt[i1-1][j1-1];
    }
    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    private static String next() throws IOException {
        while (st==null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class F {

    static StringTokenizer st;
    static BufferedReader br;
    static PrintWriter pw;
    static int[][]cnt;
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int m = nextInt();
        char[][]a = new char[n+1][m+1];
        cnt = new int[n+1][m+1];
        for (int i = 1; i <= n; i++) {
            String s = next();
            for (int j = 1; j <= m; j++) {
                a[i][j] = s.charAt(j-1);
            }
        }
        for (int i = 1; i <= n; i++) {
            int s = 0;
            for (int j = 1; j <= m; j++) {
                if (a[i][j]=='#')
                    s++;
                cnt[i][j] = s + cnt[i-1][j];
            }
        }
        long ans = 0;
        int[]L1 = new int[n+2], R1 = new int[n+2];
        int[]L2 = new int[n+2], R2 = new int[n+2];
        for (int j = 2; j < m; j++) {
            Arrays.fill(L1, 0);
            Arrays.fill(R1, 0);
            Arrays.fill(L2, 0);
            Arrays.fill(R2, 0);
            for (int i = 2; i < n; i++) {
                if (a[i][j] != '.') {
                    L1[i] = 0;
                    R1[i] = 0;
                }
                else {
                    L1[i] = L1[i-1];
                    R1[i] = R1[i-1];
                }
                if (count(i, 1, i, j)==0)
                    L1[i]++;
                if (count(i, j, i, m)==0)
                    R1[i]++;
            }
            for (int i = n-1; i >= 2; i--) {
                if (a[i][j]!='.') {
                    L2[i] = 0;
                    R2[i] = 0;
                }
                else {
                    L2[i] = L2[i+1];
                    R2[i] = R2[i+1];
                }
                if (count(i, 1, i, j)==0)
                    L2[i]++;
                if (count(i, j, i, m)==0)
                    R2[i]++;
            }
            for (int i = 2; i <= n-1; i++) {
                if (count(i, 1, i, j)==0) {
                    ans += L2[i+2];
                    ans += R1[i-1];
                    ans += R2[i+1];
                }
                if (count(i, j, i, m)==0) {
                    ans += R2[i+2];
                }
            }
        }
        for (int i = 2; i < n; i++) {
            if (count(i, 1, i, m)==0)
                ans++;
        }
        int[]U1 = new int[m+2], D1 = new int[m+2];
        int[]U2 = new int[m+2], D2 = new int[m+2];
        for (int i = 2; i < n; i++) {
            Arrays.fill(U1, 0);
            Arrays.fill(D1, 0);
            Arrays.fill(U2, 0);
            Arrays.fill(D2, 0);
            for (int j = 2; j < m; j++) {
                if (a[i][j] != '.') {
                    U1[j] = 0;
                    D1[j] = 0;
                }
                else {
                    U1[j] = U1[j-1];
                    D1[j] = D1[j-1];
                }
                if (count(1, j, i, j)==0)
                    U1[j]++;
                if (count(i, j, n, j)==0)
                    D1[j]++;
            }
            for (int j = m-1; j >= 2; j--) {
                if (a[i][j] != '.') {
                    U2[j] = 0;
                    D2[j] = 0;
                }
                else {
                    U2[j] = U2[j+1];
                    D2[j] = D2[j+1];
                }
                if (count(1, j, i, j)==0)
                    U2[j]++;
                if (count(i, j, n, j)==0)
                    D2[j]++;
            }
            for (int j = 2; j <= m-1; j++) {
                if (count(1, j, i, j)==0) {
                    ans += U2[j+2];
                    ans += D1[j-1];
                    ans += D2[j+1];
                }
                if (count(i, j, n, j)==0) {
                    ans += D2[j+2];
                }
            }
        }
        for (int j = 2; j < m; j++) {
            if (count(1, j, n, j)==0)
                ans++;
        }
        for (int i = 2; i < n; i++) {
            for (int j = 2; j < m; j++) {
                if (count(1, j, i, j)==0 && count(i, 1, i, j)==0)
                    ans++;
                if (count(1, j, i, j)==0 && count(i, j, i, m)==0)
                    ans++;
                if (count(i, j, n, j)==0 && count(i, 1, i, j)==0)
                    ans++;
                if (count(i, j, n, j)==0 && count(i, j, i, m)==0)
                    ans++;
            }
        }
        System.out.println(ans);
        pw.close();
    }
    private static int count(int i1, int j1, int i2, int j2) {
        return cnt[i2][j2]-cnt[i1-1][j2]-cnt[i2][j1-1]+cnt[i1-1][j1-1];
    }
    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    private static String next() throws IOException {
        while (st==null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class F {

    static StringTokenizer st;
    static BufferedReader br;
    static PrintWriter pw;
    static int[][]cnt;
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int m = nextInt();
        char[][]a = new char[n+1][m+1];
        cnt = new int[n+1][m+1];
        for (int i = 1; i <= n; i++) {
            String s = next();
            for (int j = 1; j <= m; j++) {
                a[i][j] = s.charAt(j-1);
            }
        }
        for (int i = 1; i <= n; i++) {
            int s = 0;
            for (int j = 1; j <= m; j++) {
                if (a[i][j]=='#')
                    s++;
                cnt[i][j] = s + cnt[i-1][j];
            }
        }
        long ans = 0;
        int[]L2 = new int[n+2], R2 = new int[n+2];
        for (int j = 2; j < m; j++) {
            Arrays.fill(L2, 0);
            Arrays.fill(R2, 0);
            for (int i = n-1; i >= 2; i--) {
                if (a[i][j] != '.') {
                    L2[i] = 0;
                    R2[i] = 0;
                }
                else {
                    L2[i] = L2[i+1];
                    R2[i] = R2[i+1];
                }
                if (count(i, 1, i, j)==0)
                    L2[i]++;
                if (count(i, j, i, m)==0)
                    R2[i]++;
            }
            for (int i = 2; i <= n-1; i++) {
                if (count(i, 1, i, j)==0) {
                    if (a[i+1][j]=='.')
                        ans += L2[i+2];
                    ans += R2[i+1];
                }
                if (count(i, j, i, m)==0) {
                    if (a[i+1][j]=='.')
                        ans += R2[i+2];
                    ans += L2[i+1];
                }
            }
        }
        for (int i = 2; i < n; i++) {
            if (count(i, 1, i, m)==0)
                ans++;
        }
        int[]U2 = new int[m+2], D2 = new int[m+2];
        for (int i = 2; i < n; i++) {
            Arrays.fill(U2, 0);
            Arrays.fill(D2, 0);
            for (int j = m-1; j >= 2; j--) {
                if (a[i][j] != '.') {
                    U2[j] = 0;
                    D2[j] = 0;
                }
                else {
                    U2[j] = U2[j+1];
                    D2[j] = D2[j+1];
                }
                if (count(1, j, i, j)==0)
                    U2[j]++;
                if (count(i, j, n, j)==0)
                    D2[j]++;
            }
            for (int j = 2; j <= m-1; j++) {
                if (count(1, j, i, j)==0) {
                    if (a[i][j+1]=='.')
                        ans += U2[j+2];
                    ans += D2[j+1];
                }
                if (count(i, j, n, j)==0) {
                    if (a[i][j+1]=='.')
                        ans += D2[j+2];
                    ans += U2[j+1];
                }
            }
        }
        for (int j = 2; j < m; j++) {
            if (count(1, j, n, j)==0)
                ans++;
        }
        for (int i = 2; i < n; i++) {
            for (int j = 2; j < m; j++) {
                if (count(1, j, i, j)==0 && count(i, 1, i, j)==0)
                    ans++;
                if (count(1, j, i, j)==0 && count(i, j, i, m)==0)
                    ans++;
                if (count(i, j, n, j)==0 && count(i, 1, i, j)==0)
                    ans++;
                if (count(i, j, n, j)==0 && count(i, j, i, m)==0)
                    ans++;
            }
        }
        System.out.println(ans);
        pw.close();
    }
    private static int count(int i1, int j1, int i2, int j2) {
        return cnt[i2][j2]-cnt[i1-1][j2]-cnt[i2][j1-1]+cnt[i1-1][j1-1];
    }
    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    private static String next() throws IOException {
        while (st==null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class F {

	static StringTokenizer st;
	static BufferedReader br;
	static PrintWriter pw;
	static int[][]cnt;
	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int n = nextInt();
		int m = nextInt();
		char[][]a = new char[n+1][m+1];
		cnt = new int[n+1][m+1];
		for (int i = 1; i <= n; i++) {
			String s = next();
			for (int j = 1; j <= m; j++) {
				a[i][j] = s.charAt(j-1);
			}
		}
		for (int i = 1; i <= n; i++) {
			int s = 0;
			for (int j = 1; j <= m; j++) {
				if (a[i][j]=='#')
					s++;
				cnt[i][j] = s + cnt[i-1][j];
			}
		}
		long ans = 0;
		int[]L1 = new int[n+1], R1 = new int[n+1];
		int[]L2 = new int[n+1], R2 = new int[n+1];
		for (int j = 2; j < m; j++) {
			Arrays.fill(L1, 0);
			Arrays.fill(R1, 0);
			Arrays.fill(L2, 0);
			Arrays.fill(R2, 0);
			for (int i = 2; i < n; i++) {
				if (count(i, 1, i, j)==0)
					L1[i] = L1[i-1]+1;
				if (count(i, j, i, m)==0)
					R1[i] = R1[i-1]+1;
			}
			for (int i = n-1; i >= 2; i--) {
				if (count(i, 1, i, j)==0)
					L2[i] = 1;
				if (count(i, j, i, m)==0)
					R2[i] = 1;
			}
			for (int i = 2; i < n-1; i++) {
				ans += (long)L1[i] * R2[i+1];
				ans += (long)L1[i] * L2[i+2];
				ans += (long)R1[i] * L2[i+1];
				ans += (long)R1[i] * R2[i+2];
			}
		}
		for (int i = 2; i < n; i++) {
			if (count(i, 1, i, m)==0)
				ans++;
		}
		int[]U1 = new int[m+1], D1 = new int[m+1];
		int[]U2 = new int[m+1], D2 = new int[m+1];
		for (int i = 2; i < n; i++) {
			Arrays.fill(U1, 0);
			Arrays.fill(D1, 0);
			Arrays.fill(U2, 0);
			Arrays.fill(D2, 0);
			for (int j = 2; j < m; j++) {
				if (count(1, j, i, j)==0)
					U1[j] = U1[j-1]+1;
				if (count(i, j, n, j)==0)
					D1[j] = D1[j-1]+1;
			}
			for (int j = m-1; j >= 2; j--) {
				if (count(1, j, i, j)==0)
					U2[j] = 1;
				if (count(i, j, n, j)==0)
					D2[j] = 1;
			}
			for (int j = 2; j < m-1; j++) {
				ans += (long)U1[j] * D2[j+1];
				ans += (long)U1[j] * U2[j+2];
				ans += (long)D1[j] * U2[j+1];
				ans += (long)D1[j] * D2[j+2];
			}
		}
		for (int j = 2; j < m; j++) {
			if (count(1, j, n, j)==0)
				ans++;
		}
		for (int i = 2; i < n; i++) {
			for (int j = 2; j < m; j++) {
				if (count(1, j, i, j)==0 && count(i, 1, i, j)==0)
					ans++;
				if (count(1, j, i, j)==0 && count(i, j, i, m)==0)
					ans++;
				if (count(i, j, n, j)==0 && count(i, 1, i, j)==0)
					ans++;
				if (count(i, j, n, j)==0 && count(i, j, i, m)==0)
					ans++;
			}
		}
		System.out.println(ans);
		pw.close();
	}
	private static int count(int i1, int j1, int i2, int j2) {
		return cnt[i2][j2]-cnt[i1-1][j2]-cnt[i2][j1-1]+cnt[i1-1][j1-1];
	}
	private static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
	private static long nextLong() throws IOException {
		return Long.parseLong(next());
	}
	private static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}
	private static String next() throws IOException {
		while (st==null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class F {

    static StringTokenizer st;
    static BufferedReader br;
    static PrintWriter pw;
    static int[][]cnt;
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int m = nextInt();
        char[][]a = new char[n+1][m+1];
        cnt = new int[n+1][m+1];
        for (int i = 1; i <= n; i++) {
            String s = next();
            for (int j = 1; j <= m; j++) {
                a[i][j] = s.charAt(j-1);
            }
        }
        for (int i = 1; i <= n; i++) {
            int s = 0;
            for (int j = 1; j <= m; j++) {
                if (a[i][j]=='#')
                    s++;
                cnt[i][j] = s + cnt[i-1][j];
            }
        }
        long ans = 0;
        int[]L1 = new int[n+1], R1 = new int[n+1];
        int[]L2 = new int[n+1], R2 = new int[n+1];
        for (int j = 2; j < m; j++) {
            Arrays.fill(L1, 0);
            Arrays.fill(R1, 0);
            Arrays.fill(L2, 0);
            Arrays.fill(R2, 0);
            for (int i = 2; i < n; i++) {
                if (a[i][j] != '.') {
                    L1[i] = 0;
                    R1[i] = 0;
                }
                else {
                    L1[i] = L1[i-1];
                    R1[i] = R1[i-1];
                }
                if (count(i, 1, i, j)==0)
                    L1[i]++;
                if (count(i, j, i, m)==0)
                    R1[i]++;
            }
            for (int i = n-1; i >= 2; i--) {
                if (a[i][j]!='.') {
                    L2[i] = 0;
                    R2[i] = 0;
                }
                else {
                    L2[i] = L2[i+1];
                    R2[i] = R2[i+1];
                }
                if (count(i, 1, i, j)==0)
                    L2[i]++;
                if (count(i, j, i, m)==0)
                    R2[i]++;
            }
            for (int i = 2; i < n-1; i++) {
                if (count(i, 1, i, j)==0) {
                    ans += L2[i+2];
                    ans += R1[i-1];
                    ans += R2[i+1];
                }
                if (count(i, j, i, m)==0) {
                    ans += R2[i+2];
                }
            }
        }
        for (int i = 2; i < n; i++) {
            if (count(i, 1, i, m)==0)
                ans++;
        }
        int[]U1 = new int[m+1], D1 = new int[m+1];
        int[]U2 = new int[m+1], D2 = new int[m+1];
        for (int i = 2; i < n; i++) {
            Arrays.fill(U1, 0);
            Arrays.fill(D1, 0);
            Arrays.fill(U2, 0);
            Arrays.fill(D2, 0);
            for (int j = 2; j < m; j++) {
                if (a[i][j] != '.') {
                    U1[j] = 0;
                    D1[j] = 0;
                }
                else {
                    U1[j] = U1[j-1];
                    D1[j] = D1[j-1];
                }
                if (count(1, j, i, j)==0)
                    U1[j]++;
                if (count(i, j, n, j)==0)
                    D1[j]++;
            }
            for (int j = m-1; j >= 2; j--) {
                if (a[i][j] != '.') {
                    U2[j] = 0;
                    D2[j] = 0;
                }
                else {
                    U2[j] = U2[j+1];
                    D2[j] = D2[j+1];
                }
                if (count(1, j, i, j)==0)
                    U2[j]++;
                if (count(i, j, n, j)==0)
                    D2[j]++;
            }
            for (int j = 2; j < m-1; j++) {
                if (count(1, j, i, j)==0) {
                    ans += U2[j+2];
                    ans += D1[j-1];
                    ans += D2[j+1];
                }
                if (count(i, j, n, j)==0) {
                    ans += D2[j+2];
                }
            }
        }
        for (int j = 2; j < m; j++) {
            if (count(1, j, n, j)==0)
                ans++;
        }
        for (int i = 2; i < n; i++) {
            for (int j = 2; j < m; j++) {
                if (count(1, j, i, j)==0 && count(i, 1, i, j)==0)
                    ans++;
                if (count(1, j, i, j)==0 && count(i, j, i, m)==0)
                    ans++;
                if (count(i, j, n, j)==0 && count(i, 1, i, j)==0)
                    ans++;
                if (count(i, j, n, j)==0 && count(i, j, i, m)==0)
                    ans++;
            }
        }
        System.out.println(ans);
        pw.close();
    }
    private static int count(int i1, int j1, int i2, int j2) {
        return cnt[i2][j2]-cnt[i1-1][j2]-cnt[i2][j1-1]+cnt[i1-1][j1-1];
    }
    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    private static String next() throws IOException {
        while (st==null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}


import java.util.*;
import java.io.*;

public class PashaAndPipe518F {
    static long count = 0;
    static int[][] map = null;
    static int n = 0;
    static int m = 0;

    static void go() {
        n = in.nextInt();
        m = in.nextInt();
        map = new int[n][m];
        for (int i = 0; i < n; i++) {
            String line = in.nextString();
            for (int j = 0; j < m; j++) {
                if (line.charAt(j) == '.')
                    map[i][j] = 2;
                else
                    map[i][j] = 0;
            }
        }

        map[0][0] = map[0][m - 1] = map[n - 1][0] = map[n - 1][m - 1] = 0;

        count = 0;
        // dir : 0 = down, 1 = up, 2 = left, 3 = right
        for (int i = 1; i < m - 1; i++) {
            if (map[0][i] != 0) {
                map[0][i] = 1;
                dfs(0, 1, i, 0);
                map[0][i] = 2;
            }
            if (map[n - 1][i] != 0) {
                map[n - 1][i] = 1;
                dfs(1, n - 2, i, 0);
                map[n - 1][i] = 2;
            }
        }
        for (int i = 1; i < n - 1; i++) {
            if (map[i][0] != 0) {
                map[i][0] = 1;
                dfs(3, i, 1, 0);
                map[i][0] = 2;
            }
            if (map[i][m - 1] != 0) {
                map[i][m - 1] = 1;
                dfs(2, i, m - 2, 0);
                map[i][m - 1] = 2;
            }
        }

        out.println(count / 2);
    }

    static void dfs(int dir, int r, int c, int turn) {

        if (r < 0 || r >= n || c < 0 || c >= m || map[r][c] == 0)
            return;
        if (dir <= 1 && (map[r][c - 1] == 1 || map[r][c + 1] == 1)) {
            // from up or down
            return;
        }
        if (dir >= 2 && (map[r - 1][c] == 1 || map[r + 1][c] == 1)) {
            // from left or right
            return;
        }
        if (r == 0 || r == n - 1 || c == 0 || c == m - 1) {
            count++;
            return;
        }
        map[r][c] = 1;
        switch (dir) {
            case 0:
                dfs(0, r + 1, c, turn);
                if (turn <= 1) {
                    dfs(2, r, c - 1, turn + 1);
                    dfs(3, r, c + 1, turn + 1);
                }
                break;
            case 1:
                dfs(1, r - 1, c, turn);
                if (turn <= 1) {
                    dfs(2, r, c - 1, turn + 1);
                    dfs(3, r, c + 1, turn + 1);
                }
                break;
            case 2:
                dfs(2, r, c - 1, turn);
                if (turn <= 1) {
                    dfs(0, r + 1, c, turn + 1);
                    dfs(1, r - 1, c, turn + 1);
                }
                break;
            case 3:
                dfs(3, r, c + 1, turn);
                if (turn <= 1) {
                    dfs(0, r + 1, c, turn + 1);
                    dfs(1, r - 1, c, turn + 1);
                }
                break;
        }
        map[r][c] = 2;
    }

    static InputReader in;
    static PrintWriter out;

    public static void main(String[] args) {
        in = new InputReader(System.in);
        out = new PrintWriter(System.out);

        go();

        out.close();
    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int[] nextIntArray(int len) {
            int[] ret = new int[len];
            for (int i = 0; i < len; i++)
                ret[i] = nextInt();
            return ret;
        }

        public long[] nextLongArray(int len) {
            long[] ret = new long[len];
            for (int i = 0; i < len; i++)
                ret[i] = nextLong();
            return ret;
        }

        public int nextInt() {
            return (int) nextLong();
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder sb = new StringBuilder(1024);
            do {
                sb.append((char) c);
                c = read();
            } while (!isSpaceChar(c));
            return sb.toString();
        }

        public static boolean isSpaceChar(int c) {
            switch (c) {
                case -1:
                case ' ':
                case '\n':
                case '\r':
                case '\t':
                    return true;
                default:
                    return false;
            }
        }
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class Solution {
    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    void solve() throws IOException {
        //in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt"), "ISO-8859-1"));
        //out = new PrintWriter(new OutputStreamWriter(new FileOutputStream("output.txt"), "ISO-8859-1"));

        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        Locale.setDefault(Locale.ENGLISH);

        int n = nextInt();
        int m = nextInt();

        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            String s = in.readLine();
            for (int j = 0; j < m; j++) {
                a[i][j] = s.charAt(j);
            }
        }

        char[][] ta = new char[m][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                ta[m - 1 - j][i] = a[i][j];
            }
        }

        long ans = calc(a, n, m, false);
        ans += calc(ta, m, n, true);

        out.print(ans);

        in.close();
        out.close();
    }

    long calc(char[][] a, int n, int m, boolean rev) {
        int[][] sumL = new int[n][m + 1];

        for (int i = 0; i < n; i++) {
            sumL[i][0] = 0;
            for (int j = 1; j <= m; j++) {
                sumL[i][j] = sumL[i][j - 1] + (a[i][j - 1] == '#' ? 1 : 0);
            }
        }

        long res = 0;

        for (int i = 1; i < n - 1; i++) {
            if (sumL[i][m] == 0) {
                res++;
            }
        }

        if (!rev) {
            int[][] sumU = new int[n + 1][m];

            for (int j = 0; j < m; j++) {
                sumL[0][j] = 0;
                for (int i = 1; i <= n; i++) {
                    sumU[i][j] = sumL[i - 1][j] + (a[i - 1][j] == '#' ? 1 : 0);
                }
            }

            for (int i = 1; i < n - 1; i++) {
                for (int j = 1; j < m - 1; j++) {
                    if (sumL[i][j + 1] == 0 && sumU[i + 1][j] == 0) {
                        res++;
                    }
                    if (sumL[i][m] - sumL[i][j] == 0 && sumU[i + 1][j] == 0) {
                        res++;
                    }
                    if (sumL[i][j + 1] == 0 && sumU[n][j] - sumU[i][j] == 0) {
                        res++;
                    }
                    if (sumL[i][m] - sumL[i][j] == 0 && sumU[n][j] - sumU[i][j] == 0) {
                        res++;
                    }
                }
            }
        }

        int[][] cntLU = new int[n + 1][m];
        int[][] cntRU = new int[n + 1][m];

        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < m; j++) {
                cntLU[i][j] = cntLU[i - 1][j] + (sumL[i - 1][j + 1] == 0 ? 1 : 0);
                cntRU[i][j] = cntRU[i - 1][j] + (sumL[i - 1][m] - sumL[i - 1][j] == 0 ? 1 : 0);
            }
        }

        int[][] u = new int[n][m];
        int[][] d = new int[n][m];

        for (int j = 0; j < m; j++) {
            for (int i = 1; i < n; i++) {
                int pos = i;
                while (pos < n && a[pos][j] == '.') {
                    u[pos][j] = i;
                    pos++;
                }
                i = pos;
            }

            for (int i = n - 2; i >= 0; i--) {
                int pos = i;
                while (pos >= 0 && a[pos][j] == '.') {
                    d[pos][j] = i;
                    pos--;
                }
                i = pos;
            }
        }

        for (int i = 1; i < n - 1; i++) {
            for (int j = 1; j < m - 1; j++) {
                if (i - 2 >= 1 && sumL[i][m] - sumL[i][j] == 0) {
                    res += Math.max(0, cntRU[i - 1][j] - cntRU[u[i][j]][j]);
                }

                if (sumL[i][j + 1] != 0) {
                    continue;
                }

                res += Math.max(0, cntRU[i][j] - cntRU[u[i][j]][j]) + Math.max(0, cntRU[d[i][j] + 1][j] - cntRU[i + 1][j]);
                if (i - 2 >= 1) {
                    res += Math.max(0, cntLU[i - 1][j] - cntLU[u[i][j]][j]);
                }
            }
        }

        return res;
    }

    public static void main(String[] args) throws IOException {
        new Solution().solve();
    }

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class Solution {
    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    void solve() throws IOException {
        //in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt"), "ISO-8859-1"));
        //out = new PrintWriter(new OutputStreamWriter(new FileOutputStream("output.txt"), "ISO-8859-1"));

        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        Locale.setDefault(Locale.ENGLISH);

        n = nextInt();
        m = nextInt();

        a = new char[n][m];
        for (int i = 0; i < n; i++) {
            String s = in.readLine();
            for (int j = 0; j < m; j++) {
                a[i][j] = s.charAt(j);
            }
        }

        dp = new long[n][m][3][4][5];
        for (int k = 0; k < 3; k++) {
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    for (int d = 0; d < 4; d++) {
                        Arrays.fill(dp[i][j][k][d], -1);
                    }
                }
            }
        }

        long ans = 0;
        for (int i = 0; i < n; i++) {
            for (int k = 0; k < 3; k++) {
                for (int nd = 0; nd < 5; nd++) {
                    ans += calc(i, 0, k, 0, nd) + calc(i, m - 1, k, 2, nd);
                }
            }
        }

        for (int j = 0; j < m; j++) {
            for (int k = 0; k < 3; k++) {
                for (int nd = 0; nd < 5; nd++) {
                    ans += calc(0, j, k, 1, nd) + calc(n - 1, j, k, 3, nd);
                }
            }
        }

        out.print(ans / 2);

        in.close();
        out.close();
    }

    int n, m;
    char[][] a;
    long[][][][][] dp;
    int[] dx = {0, 1, 0, -1};
    int[] dy = {1, 0, -1, 0};

    long calc(int x, int y, int k, int d, int nd) {
        if (dp[x][y][k][d][nd] != -1) {
            return dp[x][y][k][d][nd];
        }

        if (x == 0 && (y == 0 || y == m - 1) || x == n - 1 && (y == 0 || y == m - 1) || a[x][y] == '#') {
            return dp[x][y][k][d][nd] = 0;
        }

        if (k == 0 && nd == 4 && (x == 0 && d == 3 || x == n - 1 && d == 1 || y == 0 && d == 2 || y == m - 1 && d == 0)) {
            return dp[x][y][k][d][nd] = 1;
        }

        dp[x][y][k][d][nd] = 0;

        for (int i = 0; i < 4; i++) {
            int nx = x + dx[i];
            int ny = y + dy[i];

            if (ok(nx, ny) && !(x == 0 && nx == 0 || x == n - 1 && nx == n - 1 ||
                    y == 0 && ny == 0 || y == m - 1 && ny == m - 1)) {
                if (d == i) {
                    if (nd == 4) {
                        for (int j = 0; j < 5; j++) {
                            dp[x][y][k][d][nd] += calc(nx, ny, k, i, j);
                        }
                    }
                } else if (k > 0 && (i == (d + 1) % 4 || i == (d + 3) % 4)) {
                    if (nd == i) {
                        for (int j = 0; j < 5; j++) {
                            if (j == 4 || d != (j + 2) % 4) {
                                dp[x][y][k][d][nd] += calc(nx, ny, k - 1, i, j);
                            }
                        }
                    }
                }
            }
        }

        return dp[x][y][k][d][nd];
    }

    boolean ok(int x, int y) {
        return 0 <= x && x < n && 0 <= y && y < m;
    }

    public static void main(String[] args) throws IOException {
        new Solution().solve();
    }

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class Solution {
    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    void solve() throws IOException {
        //in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt"), "ISO-8859-1"));
        //out = new PrintWriter(new OutputStreamWriter(new FileOutputStream("output.txt"), "ISO-8859-1"));

        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        Locale.setDefault(Locale.ENGLISH);

        int n = nextInt();
        int m = nextInt();

        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            String s = in.readLine();
            for (int j = 0; j < m; j++) {
                a[i][j] = s.charAt(j);
            }
        }

        char[][] ta = new char[m][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                ta[m - 1 - j][i] = a[i][j];
            }
        }

        long ans = calc(a, n, m, false);
        ans += calc(ta, m, n, true);

        out.print(ans);

        in.close();
        out.close();
    }

    long calc(char[][] a, int n, int m, boolean rev) {
        int[][] sumL = new int[n][m + 1];

        for (int i = 0; i < n; i++) {
            sumL[i][0] = 0;
            for (int j = 1; j <= m; j++) {
                sumL[i][j] = sumL[i][j - 1] + (a[i][j - 1] == '#' ? 1 : 0);
            }
        }

        long res = 0;

        for (int i = 1; i < n - 1; i++) {
            if (sumL[i][m] == 0) {
                res++;
            }
        }

        if (!rev) {
            int[][] sumU = new int[n + 1][m];

            for (int j = 0; j < m; j++) {
                sumU[0][j] = 0;
                for (int i = 1; i <= n; i++) {
                    sumU[i][j] = sumU[i - 1][j] + (a[i - 1][j] == '#' ? 1 : 0);
                }
            }

            for (int i = 1; i < n - 1; i++) {
                for (int j = 1; j < m - 1; j++) {
                    if (sumL[i][j + 1] == 0 && sumU[i + 1][j] == 0) {
                        res++;
                    }
                    if (sumL[i][m] - sumL[i][j] == 0 && sumU[i + 1][j] == 0) {
                        res++;
                    }
                    if (sumL[i][j + 1] == 0 && sumU[n][j] - sumU[i][j] == 0) {
                        res++;
                    }
                    if (sumL[i][m] - sumL[i][j] == 0 && sumU[n][j] - sumU[i][j] == 0) {
                        res++;
                    }
                }
            }
        }

        int[][] cntLU = new int[n + 1][m];
        int[][] cntRU = new int[n + 1][m];

        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < m; j++) {
                cntLU[i][j] = cntLU[i - 1][j] + (sumL[i - 1][j + 1] == 0 ? 1 : 0);
                cntRU[i][j] = cntRU[i - 1][j] + (sumL[i - 1][m] - sumL[i - 1][j] == 0 ? 1 : 0);
            }
        }

        int[][] u = new int[n][m];
        int[][] d = new int[n][m];

        for (int j = 0; j < m; j++) {
            for (int i = 1; i < n; i++) {
                int pos = i;
                while (pos < n && a[pos][j] == '.') {
                    u[pos][j] = i;
                    pos++;
                }
                i = pos;
            }

            for (int i = n - 2; i >= 0; i--) {
                int pos = i;
                while (pos >= 0 && a[pos][j] == '.') {
                    d[pos][j] = i;
                    pos--;
                }
                i = pos;
            }
        }

        for (int i = 1; i < n - 1; i++) {
            for (int j = 1; j < m - 1; j++) {
                if (i - 2 >= 1 && sumL[i][m] - sumL[i][j] == 0) {
                    res += Math.max(0, cntRU[i - 1][j] - cntRU[u[i][j]][j]);
                }

                if (sumL[i][j + 1] != 0) {
                    continue;
                }

                res += Math.max(0, cntRU[i][j] - cntRU[u[i][j]][j]) + Math.max(0, cntRU[d[i][j] + 1][j] - cntRU[i + 1][j]);
                if (i - 2 >= 1) {
                    res += Math.max(0, cntLU[i - 1][j] - cntLU[u[i][j]][j]);
                }
            }
        }

        return res;
    }

    public static void main(String[] args) throws IOException {
        new Solution().solve();
    }

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class Solution {
    StringTokenizer st;
    BufferedReader in;
    PrintWriter out;

    void solve() throws IOException {
        //in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt"), "ISO-8859-1"));
        //out = new PrintWriter(new OutputStreamWriter(new FileOutputStream("output.txt"), "ISO-8859-1"));

        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        Locale.setDefault(Locale.ENGLISH);

        n = nextInt();
        m = nextInt();

        a = new char[n][m];
        for (int i = 0; i < n; i++) {
            String s = in.readLine();
            for (int j = 0; j < m; j++) {
                a[i][j] = s.charAt(j);
            }
        }

        dp = new long[n][m][3][4][5];
        for (int k = 0; k < 3; k++) {
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    for (int d = 0; d < 4; d++) {
                        Arrays.fill(dp[i][j][k][d], -1);
                    }
                }
            }
        }

        long ans = 0;
        for (int i = 0; i < n; i++) {
            for (int k = 0; k < 3; k++) {
                for (int nd = 0; nd < 5; nd++) {
                    ans += calc(i, 0, k, 0, nd) + calc(i, m - 1, k, 2, nd);
                }
            }
        }

        for (int j = 0; j < m; j++) {
            for (int k = 0; k < 3; k++) {
                for (int nd = 0; nd < 5; nd++) {
                    ans += calc(0, j, k, 1, nd) + calc(n - 1, j, k, 3, nd);
                }
            }
        }

        out.print(ans / 2);

        in.close();
        out.close();
    }

    int n, m;
    char[][] a;
    long[][][][][] dp;
    int[] dx = {0, 1, 0, -1};
    int[] dy = {1, 0, -1, 0};

    long calc(int x, int y, int k, int d, int nd) {
        /*if (dp[x][y][k][d][nd] != -1) {
            return dp[x][y][k][d][nd];
        }*/

        if (x == 0 && (y == 0 || y == m - 1) || x == n - 1 && (y == 0 || y == m - 1) || a[x][y] == '#') {
            return dp[x][y][k][d][nd] = 0;
        }

        if (k == 0 && nd == 4 && (x == 0 && d == 3 || x == n - 1 && d == 1 || y == 0 && d == 2 || y == m - 1 && d == 0)) {
            return dp[x][y][k][d][nd] = 1;
        }

        dp[x][y][k][d][nd] = 0;

        for (int i = 0; i < 4; i++) {
            int nx = x + dx[i];
            int ny = y + dy[i];

            if (ok(nx, ny) && !(x == 0 && nx == 0 || x == n - 1 && nx == n - 1 ||
                    y == 0 && ny == 0 || y == m - 1 && ny == m - 1)) {
                if (d == i) {
                    if (nd == 4) {
                        for (int j = 0; j < 5; j++) {
                            dp[x][y][k][d][nd] += calc(nx, ny, k, i, j);
                        }
                    }
                } else if (k > 0 && (i == (d + 1) % 4 || i == (d + 3) % 4)) {
                    if (nd == i) {
                        for (int j = 0; j < 5; j++) {
                            if (j == 4 || d != (j + 2) % 4) {
                                dp[x][y][k][d][nd] += calc(nx, ny, k - 1, i, j);
                            }
                        }
                    }
                }
            }
        }

        return dp[x][y][k][d][nd];
    }

    boolean ok(int x, int y) {
        return 0 <= x && x < n && 0 <= y && y < m;
    }

    public static void main(String[] args) throws IOException {
        new Solution().solve();
    }

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.util.Scanner;

public class FMain {

    int n;
    int m;

    char[][] field;

    int countTrue(boolean[] ar){
        int count = 0;
        for(boolean b : ar){
            if(b) ++count;
        }
        return count;
    }
    int countNeib(boolean[] ar){
        int count = 0;
        for(int i = 0; i < ar.length - 1; ++i){
            if(ar[i] && ar[i + 1])++count;
        }
        return count;
    }

    int countEq(boolean[] ar1, boolean[] ar2){
        int count = 0;
        for(int i = 0; i < ar1.length; ++i){
            if(ar1[i] && ar2[i])++count;
        }
        return count;
    }

    long count3(char[][] field, int n, int m, int[] upDist, int[] downDist){
        long count = 0;
        for(int i = 1; i < n - 1; ++i){
            int startPos = 1;
            while(startPos < m && field[i][startPos] != '.')++startPos;
            while(startPos < m) {
                int endPos = startPos;
                while (field[i][endPos] == '.') ++endPos;
                if (endPos - startPos > 1) {
                    boolean[] up = new boolean[endPos - startPos];
                    boolean[] down = new boolean[endPos - startPos];
                    for(int j = 0; j < endPos - startPos; ++j){
                        if(upDist[j + startPos] > i) up[j] = true;
                        if(downDist[j + startPos] > n - i - 1) down[j] = true;
                    }

                    int upCount = countTrue(up);
                    int downCount = countTrue(down);

                    count += upCount * (upCount - 1) / 2 - countNeib(up);
                    count += downCount * (downCount - 1) / 2 - countNeib(down);
                    count += upCount * downCount - countEq(up, down);
                }
                startPos = endPos;
                while (startPos < m && field[i][startPos] != '.') ++startPos;
            }
        }
        return count;
    }

    public void solve() {
        Parser parser = new Parser();
        n = parser.nextInteger();
        m = parser.nextInteger();
        parser.nextLine();

        field = new char[n][];
        for(int i = 0; i < n; ++i){
            field[i] = parser.nextLine().toCharArray();
        }

        int[] leftDist = new int[n];
        int[] rightDist = new int[n];
        int[] upDist = new int[m];
        int[] downDist = new int[m];

        long count = 0;

        for(int i = 1; i < n - 1; ++i){
            int left = 0;
            while(left < m && field[i][left] == '.')++left;
            leftDist[i] = left;
            int right = 0;
            while(right < m && field[i][m - right - 1] == '.')++right;
            rightDist[i] = right;
            if(left == m) ++count;
            field[i][0] = '#';
            field[i][m - 1] = '#';
        }

        for(int i = 1; i < m - 1; ++i){
            int up = 0;
            while(up < n && field[up][i] == '.')++up;
            upDist[i] = up;
            int down = 0;
            while(down < n && field[n - down - 1][i] == '.')++down;
            downDist[i] = down;
            if(up == n) ++count;
            field[0][i] = '#';
            field[n - 1][i] = '#';
        }

        for(int i = 1; i < n - 1; ++i){
            for(int j = 1; j < m - 1; ++j){
                if(leftDist[i] > j && upDist[j] > i)++count;
                if(leftDist[i] > j && downDist[j] > n - i - 1)++count;
                if(rightDist[i] > m - j - 1 && upDist[j] > i)++count;
                if(rightDist[i] > m - j - 1 && downDist[j] > n - i - 1)++count;
            }
        }

        count += count3(field, n, m, upDist, downDist);

        char[][] field2 = new char[m][];
        for(int j = 0; j < m; ++j){
            field2[j] = new char[n];
            for(int i = 0; i < n; ++ i){
                field2[j][i] = field[i][j];
            }
        }

        count += count3(field2, m, n, leftDist, rightDist);

        System.out.print(count);

    }

    public static void main(String[] args) {
        new FMain().solve();
    }

    static public class Parser{
        Scanner scanner;

        public Parser() {
            scanner = new Scanner(System.in);
        }

        public Parser(String str) {
            scanner = new Scanner(str);
        }

        long nextLong(){
            return scanner.nextLong();
        }

        int nextInteger(){
            return scanner.nextInt();
        }

        double nextDouble(){
            return scanner.nextDouble();
        }

        String nextLine(){
            return scanner.nextLine();
        }

        int[] nextIntegers(int count){
            int[] result = new int[count];
            for(int i = 0; i < count; ++i){
                result[i] = nextInteger();
            }
            return result;
        }

        long[] nextLongs(int count){
            long[] result = new long[count];
            for(int i = 0; i < count; ++i){
                result[i] = nextLong();
            }
            return result;
        }

        int[][] nextIntegers(int fields, int count){
            int[][] result = new int[fields][];
            for(int i = 0; i < fields; ++i){
                result[i] = new int[count];
            }
            for(int c = 0; c < count; ++c){
                for(int i = 0; i < fields; ++i){
                    result[i][c] = nextInteger();
                }
            }
            return result;
        }
    }

    static public class Matrix{
        static public final int size = 101;
        static public final long base = 1000000007;

        static public class Vector{
            long[] data = new long[size];
        }
        private long[] data;

        public Matrix() {
            data = new long[size * size];
        }

        long get(int row, int column){
            return data[row * size + column];
        }

        long set(int row, int column, long value){
            int index = row * size + column;
            long result = data[index];
            data[index] = value;
            return result;
        }

        public Matrix mul(Matrix other){
            Matrix result = new Matrix();
            for(int r = 0; r < size; ++r){
                for(int c = 0; c < size; ++c){
                    long value = 0;
                    for(int i = 0; i < size; ++i){
                        value += get(r, i) * other.get(i, c);
                        value %= base;
                    }
                    result.set(r, c, value);
                }
            }
            return result;
        }

    }
}


import java.util.Scanner;

public class FMain {

    int n;
    int m;

    char[][] field;

    int countTrue(boolean[] ar){
        int count = 0;
        for(boolean b : ar){
            if(b) ++count;
        }
        return count;
    }
    int countNeib(boolean[] ar){
        int count = 0;
        for(int i = 0; i < ar.length - 1; ++i){
            if(ar[i] && ar[i + 1])++count;
        }
        return count;
    }

    int countEq(boolean[] ar1, boolean[] ar2){
        int count = 0;
        for(int i = 0; i < ar1.length; ++i){
            if(ar1[i] && ar2[i])++count;
        }
        return count;
    }

    int count3(char[][] field, int n, int m, int[] upDist, int[] downDist){
        int count = 0;
        for(int i = 1; i < n - 1; ++i){
            int startPos = 1;
            while(startPos < m && field[i][startPos] != '.')++startPos;
            while(startPos < m) {
                int endPos = startPos;
                while (field[i][endPos] == '.') ++endPos;
                if (endPos - startPos > 1) {
                    boolean[] up = new boolean[endPos - startPos];
                    boolean[] down = new boolean[endPos - startPos];
                    for(int j = 0; j < endPos - startPos; ++j){
                        if(upDist[j + startPos] > i) up[j] = true;
                        if(downDist[j + startPos] > n - i - 1) down[j] = true;
                    }

                    int upCount = countTrue(up);
                    int downCount = countTrue(down);

                    count += upCount * (upCount - 1) / 2 - countNeib(up);
                    count += downCount * (downCount - 1) / 2 - countNeib(down);
                    count += upCount * downCount - countEq(up, down);
                }
                startPos = endPos;
                while (startPos < m && field[i][startPos] != '.') ++startPos;
            }
        }
        return count;
    }

    public void solve() {
        Parser parser = new Parser();
        n = parser.nextInteger();
        m = parser.nextInteger();
        parser.nextLine();

        field = new char[n][];
        for(int i = 0; i < n; ++i){
            field[i] = parser.nextLine().toCharArray();
        }

        int[] leftDist = new int[n];
        int[] rightDist = new int[n];
        int[] upDist = new int[m];
        int[] downDist = new int[m];

        int count = 0;

        for(int i = 1; i < n - 1; ++i){
            int left = 0;
            while(left < m && field[i][left] == '.')++left;
            leftDist[i] = left;
            int right = 0;
            while(right < m && field[i][m - right - 1] == '.')++right;
            rightDist[i] = right;
            if(left == m) ++count;
            field[i][0] = '#';
            field[i][m - 1] = '#';
        }

        for(int i = 1; i < m - 1; ++i){
            int up = 0;
            while(up < n && field[up][i] == '.')++up;
            upDist[i] = up;
            int down = 0;
            while(down < n && field[n - down - 1][i] == '.')++down;
            downDist[i] = down;
            if(up == n) ++count;
            field[0][i] = '#';
            field[n - 1][i] = '#';
        }

        for(int i = 1; i < n - 1; ++i){
            for(int j = 1; j < m - 1; ++j){
                if(leftDist[i] > j && upDist[j] > i)++count;
                if(leftDist[i] > j && downDist[j] > n - i - 1)++count;
                if(rightDist[i] > m - j - 1 && upDist[j] > i)++count;
                if(rightDist[i] > m - j - 1 && downDist[j] > n - i - 1)++count;
            }
        }

        count += count3(field, n, m, upDist, downDist);

        char[][] field2 = new char[m][];
        for(int j = 0; j < m; ++j){
            field2[j] = new char[n];
            for(int i = 0; i < n; ++ i){
                field2[j][i] = field[i][j];
            }
        }

        count += count3(field2, m, n, leftDist, rightDist);

        System.out.print(count);

    }

    public static void main(String[] args) {
        new FMain().solve();
    }

    static public class Parser{
        Scanner scanner;

        public Parser() {
            scanner = new Scanner(System.in);
        }

        public Parser(String str) {
            scanner = new Scanner(str);
        }

        long nextLong(){
            return scanner.nextLong();
        }

        int nextInteger(){
            return scanner.nextInt();
        }

        double nextDouble(){
            return scanner.nextDouble();
        }

        String nextLine(){
            return scanner.nextLine();
        }

        int[] nextIntegers(int count){
            int[] result = new int[count];
            for(int i = 0; i < count; ++i){
                result[i] = nextInteger();
            }
            return result;
        }

        long[] nextLongs(int count){
            long[] result = new long[count];
            for(int i = 0; i < count; ++i){
                result[i] = nextLong();
            }
            return result;
        }

        int[][] nextIntegers(int fields, int count){
            int[][] result = new int[fields][];
            for(int i = 0; i < fields; ++i){
                result[i] = new int[count];
            }
            for(int c = 0; c < count; ++c){
                for(int i = 0; i < fields; ++i){
                    result[i][c] = nextInteger();
                }
            }
            return result;
        }
    }

    static public class Matrix{
        static public final int size = 101;
        static public final long base = 1000000007;

        static public class Vector{
            long[] data = new long[size];
        }
        private long[] data;

        public Matrix() {
            data = new long[size * size];
        }

        long get(int row, int column){
            return data[row * size + column];
        }

        long set(int row, int column, long value){
            int index = row * size + column;
            long result = data[index];
            data[index] = value;
            return result;
        }

        public Matrix mul(Matrix other){
            Matrix result = new Matrix();
            for(int r = 0; r < size; ++r){
                for(int c = 0; c < size; ++c){
                    long value = 0;
                    for(int i = 0; i < size; ++i){
                        value += get(r, i) * other.get(i, c);
                        value %= base;
                    }
                    result.set(r, c, value);
                }
            }
            return result;
        }

    }
}


import java.util.*;
import java.io.*;

public class F
{
   public static void main(String[] args)
   {
      PrintWriter out = new PrintWriter(System.out);
      new F(new FastScanner(), out);
      out.close();
   }

   // Down, Right, Up, Left
   int R, C;
   int[] dr = {1, 0, -1, 0};
   int[] dc = {0,  1, 0, -1};
   boolean[][] isBlocked;
   Integer[][][] memo;
   int go(int dir, int r, int c)
   {
      if (r < 0 || c < 0 || r >= R || c >= C) return 0;
      if (isBlocked[r][c]) return 0;
      if (memo[dir][r][c] != null) return memo[dir][r][c];
      return memo[dir][r][c] = 1+go(dir, r+dr[dir], c+dc[dir]);
   }

   public F(FastScanner in, PrintWriter out)
   {
      R = in.nextInt();
      C = in.nextInt();
      long res = 0;
      isBlocked = new boolean[R][C];
      memo = new Integer[4][R][C];
      for (int i=0; i<R; i++)
      {
         String s = in.next();
         for (int j=0; j<C; j++)
            isBlocked[i][j] = s.charAt(j) == '#';
      }

      for (int i=1; i+1<R; i++)
         if (go(1, i, 0) == C) res++;
      for (int j=1; j+1<C; j++)
         if (go(0, 0, j) == R) res++;

      for (int j=1; j+1<C; j++)
      {
         boolean lastLeft = false;
         boolean lastRight = false;

         int numLeft = 0, numRight = 0;
         for (int i=1; i+1<R; i++)
         {
            if (isBlocked[i][j])
            {
               numLeft = 0;
               numRight = 0;
               continue;
            }

            boolean canLeft = go(3, i, j) == j+1;
            boolean canDown = go(0, i, j) == (R-i);
            boolean canRight = go(1, i, j) == (C-j);

            if (canLeft)
               res += numLeft+numRight+(lastLeft?-1:0);
            if (canRight)
               res += numLeft+numRight+(lastRight?-1:0);

            if (canLeft) numLeft++;
            if (canRight) numRight++;

            lastLeft = canLeft;
            lastRight = canRight;
         }
      }

      for (int i=1; i+1<R; i++)
      {
         boolean lastUp = false;
         boolean lastDown = false;
         int numDown=0, numRight=isBlocked[i][C-1] ? 0 : 1, numUp=0;
         for (int j=C-2; j>0; j--)
         {
            if (isBlocked[i][j])
            {
               numDown = 0;
               numRight = 0;
               numUp = 0;
               continue;
            }

            boolean canUp = go(2, i, j) == (i+1);
            boolean canDown = go(0, i, j) == (R-i);
            boolean canLeft = go(3, i, j) == (j+1);

            if (canLeft)
               res += numUp+numDown;
            if (canUp)
            {
               res += numUp+numDown+numRight+(lastUp ? -1 : 0);
               if (canLeft) res++;
            }
            if (canDown)
            {
               res += numUp+numDown+numRight+(lastDown ? -1 : 0);
               if (canLeft) res++;
            }
            if (canUp) numUp++;
            if (canDown) numDown++;

            lastUp = canUp;
            lastDown = canDown;
         }
      }

      out.println(res);
   }
}

class FastScanner{
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public FastScanner()
    {
        stream = System.in;
    }

    int read()
    {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars){
            curChar = 0;
            try{
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    boolean isSpaceChar(int c)
    {
        return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
    }

    boolean isEndline(int c)
    {
        return c=='\n'||c=='\r'||c==-1;
    }

    int nextInt()
    {
        return Integer.parseInt(next());
    }

    long nextLong()
    {
        return Long.parseLong(next());
    }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String next(){
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do{
            res.appendCodePoint(c);
            c = read();
        }while(!isSpaceChar(c));
        return res.toString();
    }

    String nextLine(){
        int c = read();
        while (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do{
            res.appendCodePoint(c);
            c = read();
        }while(!isEndline(c));
        return res.toString();
    }
}