#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2100;
char a[MAXN][MAXN];
int s[MAXN][MAXN];
int n, m;
long long ans;
int up(int x, int y) { return (s[x][y] == s[x][y - 1] ? 1 : 0); }
int down(int x, int y) {
  return ((s[n][y] - s[x - 1][y]) == (s[n][y - 1] - s[x - 1][y - 1]) ? 1 : 0);
}
int get_up(int x, int y) { return up(x, y) + down(x, y); }
int left(int x, int y) { return (s[x][y] == s[x - 1][y] ? 1 : 0); }
int right(int x, int y) {
  return ((s[x][m] - s[x][y - 1]) == (s[x - 1][m] - s[x - 1][y - 1]) ? 1 : 0);
}
int get_ri(int x, int y) { return left(x, y) + right(x, y); }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
  memset(s, 0, sizeof(s));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] +
                (a[i][j] == '#' ? 1 : 0);
  ans = 0;
  for (int i = 2; i < n; i++) {
    if (s[i][m] == s[i - 1][m]) ans++;
  }
  for (int j = 2; j < m; j++) {
    if (s[n][j] == s[n][j - 1]) ans++;
  }
  for (int i = 2; i < n; i++) {
    int now = 0;
    for (int j = 2; j < m; j++)
      if (a[i][j] == '.') {
        int x = get_up(i, j);
        ans += (now - ((j > 2) ? get_up(i, j - 1) : 0)) * x + x * get_ri(i, j);
        now += x;
        if (j > 2) {
          ans += up(i, j) * down(i, j - 1) + down(i, j) * up(i, j - 1);
        }
      } else
        now = 0;
  }
  for (int j = 2; j < m; j++) {
    int now = 0;
    for (int i = 2; i < n; i++)
      if (a[i][j] == '.') {
        int x = get_ri(i, j);
        ans += (now - ((i > 2) ? get_ri(i - 1, j) : 0)) * x;
        now += x;
        if (i > 2) {
          ans += right(i, j) * left(i - 1, j) + left(i, j) * right(i - 1, j);
        }
      } else
        now = 0;
  }
  cout << ans << endl;
  return 0;
}
