#include <bits/stdc++.h>
using namespace std;
const long long N = 2000 + 23;
string a[N];
char buf[N][N];
long long n, m;
void rot() {
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) buf[i][j] = a[i][j];
  for (long long i = 0; i < m; i++) {
    a[i] = "";
    for (long long j = 0; j < n; j++) a[i] += buf[j][m - 1 - i];
  }
  swap(n, m);
}
bool valid(long long x, long long y) {
  return !(x < 0 or x >= n or y < 0 or y >= m);
}
long long f1[N][N], g1[N][N];
long long G1(long long i, long long j) {
  if (!valid(i, j)) return 1;
  if (i == 0 or i == n - 1) return 0;
  long long& ret = g1[i][j];
  if (~ret) return ret;
  ret = 0;
  if (a[i][j] == '#') return ret = 0;
  return ret = G1(i, j - 1);
}
long long F1(long long i, long long j) {
  if (!valid(i, j)) return 0;
  long long& ret = f1[i][j];
  if (~ret) return ret;
  if (a[i][j] == '#') return ret = 0;
  return ret = G1(i, j) + F1(i - 1, j);
}
long long go1() {
  memset(f1, -1, sizeof(f1));
  memset(g1, -1, sizeof(g1));
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) G1(i, j);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) F1(i, j);
  long long ret = 0;
  for (long long i = 1; i < n - 1; i++) {
    if (a[i][0] == '#') continue;
    long long j = 1;
    while (j < m - 1 and a[i][j] == '.') {
      ret += F1(i, j) - G1(i, j) - G1(i - 1, j);
      j++;
    }
  }
  return ret;
}
long long g2[N][N];
long long G2(long long i, long long j) {
  if (!valid(i, j)) return 1;
  if (j == 0 or j == m - 1) return 0;
  long long& ret = g2[i][j];
  if (~ret) return ret;
  ret = 0;
  if (a[i][j] == '#') return ret = 0;
  return ret = G2(i - 1, j);
}
long long go2() {
  memset(g2, -1, sizeof(g2));
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) G2(i, j);
  long long ret = 0;
  for (long long i = 1; i < n - 1; i++) {
    if (a[i][0] == '#') continue;
    long long j = 1;
    while (j < m - 1 and a[i][j] == '.') {
      ret += G2(i, j);
      j++;
    }
  }
  return ret;
}
long long f3[N][N], f4[N][N], g3[N][N];
long long G3(long long i, long long j) {
  if (!valid(i, j)) return 1;
  if (i == 0 or i == n - 1) return 0;
  long long& ret = g3[i][j];
  if (~ret) return ret;
  ret = 0;
  if (a[i][j] == '#') return ret = 0;
  return ret = G3(i, j + 1);
}
long long F3(long long i, long long j) {
  if (!valid(i, j)) return 0;
  long long& ret = f3[i][j];
  if (~ret) return ret;
  if (a[i][j] == '#') return ret = 0;
  return ret = G3(i, j) + F3(i - 1, j);
}
long long F4(long long i, long long j) {
  if (!valid(i, j)) return 0;
  long long& ret = f4[i][j];
  if (~ret) return ret;
  if (a[i][j] == '#') return ret = 0;
  return ret = G3(i, j) + F4(i + 1, j);
}
long long go3() {
  memset(f3, -1, sizeof(f3));
  memset(f4, -1, sizeof(f4));
  memset(g3, -1, sizeof(g3));
  for (long long i = 0; i < n; i++)
    for (long long j = m - 1; j >= 0; j--) G3(i, j);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) F3(i, j);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) F4(i, j);
  long long ret = 0;
  for (long long i = 1; i < n - 1; i++) {
    if (a[i][0] == '#') continue;
    long long j = 1;
    while (j < m - 1 and a[i][j] == '.') {
      ret += F3(i, j) + F4(i, j) - 2 * G3(i, j);
      j++;
    }
    ret += G3(i, 0);
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ret = 0;
  ret += go1();
  rot();
  ret += go1();
  rot();
  ret += go1();
  rot();
  ret += go1();
  rot();
  ret += go2();
  rot();
  ret += go2();
  rot();
  ret += go2();
  rot();
  ret += go2();
  rot();
  ret += go3();
  rot();
  ret += go3();
  cout << ret << "\n";
  return 0;
}
