#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma warning(disable : 1318)
#pragma comment(linker, "/STACK:512000000")
const long long INF = (1ll << 63) - 1ll;
const long double INFd = 28e14;
const int inf = (1 << 31) - 1;
const long double EPS = 1e-8;
const long double PI = acos(-1.0);
const long long mod = 7 + 1e9;
using namespace std;
inline int next_rand() { return abs(rand() * rand() + rand()); }
struct __debug__ {
  __debug__(string filename, bool f = false) {
    if (f) return;
    if (filename == "") return;
    ios_base::sync_with_stdio(0);
    string filein = filename + ".in";
    string fileout = filename + ".out";
    freopen(filein.c_str(), "r", stdin);
    freopen(fileout.c_str(), "w", stdout);
  }
  ~__debug__() {}
};
__debug__ DEBUG("");
void solve();
int main() {
  srand('M' + 'A' + 'C' + 'l' + 'O' + 'B');
  solve();
}
const int maxn = 2000;
char t[maxn][maxn];
void solve() {
  int n, m;
  const int rect = 1 << 6;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> t[i][j];
      if (t[i][j] == '.') t[i][j] = 0;
      if (t[i][j] == '#') t[i][j] = rect;
    }
  }
  t[0][0] = rect;
  t[0][m - 1] = rect;
  t[n - 1][0] = rect;
  t[n - 1][m - 1] = rect;
  for (int i = 1; i < n - 1; ++i) {
    for (int j = 0; j < m; ++j) {
      if (t[i][j] == rect) break;
      t[i][j] += (1 << 0);
    }
  }
  for (int i = 1; i < n - 1; ++i) {
    for (int j = m - 1; j >= 0; --j) {
      if (t[i][j] == rect) break;
      t[i][j] += (1 << 2);
    }
  }
  for (int i = 1; i < m - 1; ++i) {
    for (int j = 0; j < n; ++j) {
      if (t[j][i] == rect) break;
      t[j][i] += (1 << 1);
    }
  }
  for (int i = 1; i < m - 1; ++i) {
    for (int j = n - 1; j >= 0; --j) {
      if (t[j][i] == rect) break;
      t[j][i] += (1 << 3);
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if (t[i][j] == rect)
        continue;
      else {
        if ((t[i][j] & (1 << 0)) && (t[i][j] & (1 << 1))) ++ans;
        if ((t[i][j] & (1 << 2)) && (t[i][j] & (1 << 1))) ++ans;
        if ((t[i][j] & (1 << 2)) && (t[i][j] & (1 << 3))) ++ans;
        if ((t[i][j] & (1 << 0)) && (t[i][j] & (1 << 3))) ++ans;
      }
  for (int i = 1; i < n - 1; ++i) {
    int dc = 0;
    int uc = 0;
    int df = 0;
    int uf = 0;
    for (int j = 1; j < m - 1; ++j) {
      if (t[i][j] == rect) {
        dc = 0;
        uc = 0;
        df = 0;
        uf = 0;
        continue;
      }
      int up = (t[i][j] & (1 << 1)) > 0;
      int down = (t[i][j] & (1 << 3)) > 0;
      if (up) {
        ans += uc - uf + dc;
        ++uc;
      }
      if (down) {
        ans += dc - df + uc - up;
        ++dc;
      }
      uf = up;
      df = down;
    }
    ans += (t[i][m - 1] & (1 << 0)) > 0;
  }
  for (int i = 1; i < m - 1; ++i) {
    int dc = 0;
    int uc = 0;
    int df = 0;
    int uf = 0;
    for (int j = 1; j < n - 1; ++j) {
      if (t[j][i] == rect) {
        dc = 0;
        uc = 0;
        df = 0;
        uf = 0;
        continue;
      }
      int up = (t[j][i] & (1 << 2)) > 0;
      int down = (t[j][i] & (1 << 0)) > 0;
      if (up) {
        ans += uc - uf + dc;
        ++uc;
      }
      if (down) {
        ans += dc - df + uc - up;
        ++dc;
      }
      uf = up;
      df = down;
    }
    ans += (t[n - 1][i] & (1 << 1)) > 0;
  }
  cout << ans << endl;
}
