#include <bits/stdc++.h>
using namespace std;
int H, W, u[2000][2000], r[2000][2000], l[2000][2000], d[2000][2000];
string s[2000];
long long ans;
void count0() {
  long long ret = 0;
  for (int i = 1; i < H - 1; i++)
    if (r[i][0] == W) ret++;
  for (int i = 1; i < W - 1; i++)
    if (d[0][i] == H) ret++;
  ans += ret;
}
void count1() {
  long long ret = 0;
  for (int i = 1; i < H - 1; i++)
    for (int j = 1; j < W - 1; j++) {
      if (u[i][j] == i + 1 && r[i][j] == W - j) ret++;
      if (u[i][j] == i + 1 && l[i][j] == j + 1) ret++;
      if (d[i][j] == H - i && r[i][j] == W - j) ret++;
      if (d[i][j] == H - i && l[i][j] == j + 1) ret++;
    }
  ans += ret;
}
void count2() {
  long long ret = 0;
  for (int i = 1; i < H - 1; i++) {
    int nowu = 0, nowd = 0;
    bool preu = 0, pred = 0;
    for (int j = 1; j < W - 1; j++) {
      if (s[i][j] == '#') {
        nowu = nowd = 0;
        preu = pred = 0;
      } else {
        if (d[i][j] == H - i) {
          ret += nowu;
          ret += nowd;
          if (pred) ret--;
        }
        if (u[i][j] == i + 1) {
          ret += nowd;
          ret += nowu;
          if (preu) ret--;
        }
        if (d[i][j] == H - i) {
          nowd++;
          pred = 1;
        } else {
          pred = 0;
        }
        if (u[i][j] == i + 1) {
          nowu++;
          preu = 1;
        } else {
          preu = 0;
        }
      }
    }
  }
  for (int i = 1; i < W - 1; i++) {
    int nowl = 0, nowr = 0;
    bool prel = 0, prer = 0;
    for (int j = 1; j < H - 1; j++) {
      if (s[j][i] == '#') {
        nowl = nowr = 0;
        prel = prer = 0;
      } else {
        if (r[j][i] == W - i) {
          ret += nowl;
          ret += nowr;
          if (prer) ret--;
        }
        if (l[j][i] == i + 1) {
          ret += nowr;
          ret += nowl;
          if (prel) ret--;
        }
        if (r[j][i] == W - i) {
          nowr++;
          prer = 1;
        } else {
          prer = 0;
        }
        if (l[j][i] == i + 1) {
          nowl++;
          prel = 1;
        } else {
          prel = 0;
        }
      }
    }
  }
  ans += ret;
}
void solve() {
  for (int i = 0; i < (H); ++i) {
    for (int j = 0; j < (W); ++j) {
      if (s[i][j] == '.')
        u[i][j] = (i == 0 ? 1 : u[i - 1][j] + 1);
      else
        u[i][j] = 0;
    }
  }
  for (int i = H - 1; i >= 0; i--) {
    for (int j = 0; j < (W); ++j) {
      if (s[i][j] == '.')
        d[i][j] = (i == H - 1 ? 1 : d[i + 1][j] + 1);
      else
        d[i][j] = 0;
    }
  }
  for (int i = 0; i < (H); ++i) {
    for (int j = 0; j < (W); ++j) {
      if (s[i][j] == '.')
        l[i][j] = (j == 0 ? 1 : l[i][j - 1] + 1);
      else
        l[i][j] = 0;
    }
  }
  for (int i = 0; i < (H); ++i) {
    for (int j = W - 1; j >= 0; j--) {
      if (s[i][j] == '.')
        r[i][j] = (j == W - 1 ? 1 : r[i][j + 1] + 1);
      else
        r[i][j] = 0;
    }
  }
  count0();
  count1();
  count2();
  cout << ans << endl;
}
int main() {
  cin >> H >> W;
  for (int i = 0; i < (H); ++i) cin >> s[i];
  solve();
}
