#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<vector<char> > G;
int dr[4] = {0, 1, 0, -1};
int dc[4] = {1, 0, -1, 0};
vector<vector<long long int> > cache[4][3];
long long int dp(int dir, int t, int r, int c) {
  long long int& ret = cache[dir][t][r][c];
  if (ret != -1) return ret;
  if (G[r][c] == '#') return ret = 0;
  if (r == 0 || r == N - 1) return ret = 1;
  if (c == 0 || c == M - 1) return ret = 1;
  ret = dp(dir, t, r + dr[dir], c + dc[dir]);
  if (t) {
    for (int i = 0; i < 4; i++) {
      if (i == dir) continue;
      if ((dir + 2) % 4 == i) continue;
      ret += dp(i, t - 1, r + dr[i], c + dc[i]);
    }
  }
  return ret;
}
int main() {
  scanf("%d %d", &N, &M);
  G = vector<vector<char> >(N, vector<char>(M));
  for (int i = 0; i < N; i++) {
    scanf("\n");
    for (int j = 0; j < M; j++) {
      scanf("%c", &G[i][j]);
    }
  }
  if (N == 2) {
    printf("%d", M - 2);
    return 0;
  }
  if (M == 2) {
    printf("%d", N - 2);
    return 0;
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 3; j++) {
      cache[i][j] =
          vector<vector<long long int> >(N, vector<long long int>(M, -1));
    }
  }
  long long int ans = 0;
  for (int i = 1; i < N - 1; i++) {
    if (G[i][0] != '#') ans += dp(0, 2, i, 1);
    if (G[i][M - 1] != '#') ans += dp(2, 2, i, M - 2);
  }
  for (int i = 1; i < M - 1; i++) {
    if (G[0][i] != '#') ans += dp(1, 2, 1, i);
    if (G[N - 1][i] != '#') ans += dp(3, 2, N - 2, i);
  }
  ans /= 2;
  for (int i = 1; i < N - 2; i++) {
    if (G[i][0] == '#' || G[i + 1][0] == '#') continue;
    long long int cnt = 0;
    for (int j = 1; j < M - 1; j++) {
      if (G[i][j] == '#' || G[i + 1][j] == '#') break;
      cnt++;
    }
    ans -= cnt;
  }
  for (int i = 1; i < N - 2; i++) {
    if (G[i][M - 1] == '#' || G[i + 1][M - 1] == '#') continue;
    long long int cnt = 0;
    for (int j = M - 2; j > 0; j--) {
      if (G[i][j] == '#' || G[i + 1][j] == '#') break;
      cnt++;
    }
    ans -= cnt;
  }
  for (int i = 1; i < M - 2; i++) {
    if (G[0][i] == '#' || G[0][i + 1] == '#') continue;
    long long int cnt = 0;
    for (int j = 1; j < N - 1; j++) {
      if (G[j][i] == '#' || G[j][i + 1] == '#') break;
      cnt++;
    }
    ans -= cnt;
  }
  for (int i = 1; i < M - 2; i++) {
    if (G[N - 1][i] == '#' || G[N - 1][i + 1] == '#') continue;
    long long int cnt = 0;
    for (int j = N - 2; j > 0; j--) {
      if (G[j][i] == '#' || G[j][i + 1] == '#') break;
      cnt++;
    }
    ans -= cnt;
  }
  printf("%I64d", ans);
}
