#include <bits/stdc++.h>
using namespace std;
template <class T>
T Mul(T x, T y, T P) {
  T F1 = 0;
  while (y) {
    if (y & 1) {
      F1 += x;
      if (F1 < 0 || F1 >= P) F1 -= P;
    }
    x <<= 1;
    if (x < 0 || x >= P) x -= P;
    y >>= 1;
  }
  return F1;
}
template <class T>
T Pow(T x, T y, T P) {
  T F1 = 1;
  x %= P;
  while (y) {
    if (y & 1) {
      F1 = Mul(F1, x, P);
    }
    x = Mul(x, x, P);
    y >>= 1;
  }
  return F1;
}
template <class T>
T Gcd(T x, T y) {
  if (y == 0) return x;
  T z;
  while (z = x % y) {
    x = y, y = z;
  }
  return y;
}
template <class T>
void UpdateMin(T &x, T y) {
  if (y < x) {
    x = y;
  }
}
template <class T>
void UpdateMax(T &x, T y) {
  if (x < y) {
    x = y;
  }
}
template <class T>
T Sqr(const T x) {
  return x * x;
}
template <class T>
T Abs(const T x) {
  return x < 0 ? -x : x;
}
class ReadBuffer {
 private:
  char buff[20000000];
  char *buf;

 public:
  void init(int size = 20000000) {
    fread(buff, 1, size, stdin);
    buf = buff;
  }
  template <class T>
  bool readInteger(T &x) {
    x = 0;
    while (*buf && isspace(*buf)) ++buf;
    if (*buf == 0) return false;
    static bool flag;
    flag = 0;
    if (*buf == '-')
      flag = true;
    else
      x = *buf - '0';
    while (isdigit(*++buf)) x = x * 10 + *buf - '0';
    if (flag) x = -x;
    return true;
  }
  template <class T>
  bool readFloat(T &x) {
    long double nowpos = 0.1;
    x = 0;
    while (*buf && isspace(*buf)) ++buf;
    if (*buf == 0) return false;
    static bool flag, decimal;
    decimal = flag = 0;
    if (*buf == '-')
      flag = true, ++buf;
    else if (*buf == '.')
      decimal = true;
    while (isdigit(*buf) || *buf == '.') {
      if (*buf == '.')
        decimal = true;
      else {
        if (decimal) {
          x += nowpos * (*buf - '0');
          nowpos *= 0.1;
        } else {
          x = x * 10 + *buf - '0';
        }
      }
      ++buf;
    }
    return true;
  }
  bool readChar(char c) {
    if (*buf == 0) return 0;
    return c = *buf++, 1;
  }
  bool readString(char *s) {
    while (*buf && isspace(*buf)) ++buf;
    if (!*buf) return false;
    while (!isspace(*buf)) *s++ = *buf++;
    *s++ = 0;
    return true;
  }
  int countSpacetonext() {
    int total = 0;
    while (*buf && *buf == ' ') ++total, ++buf;
    return total;
  }
  bool splitBycharactor(char *s, char Split = '\n') {
    while (*buf && *buf != Split) *s++ = *buf++;
    *s++ = 0;
    return *buf != 0;
  }
};
struct EDGE {
  int T;
  EDGE *Nxt;
};
char s[2011][2011];
bool Left[2011][2011];
bool Right[2011][2011];
bool Up[2011][2011];
bool Down[2011][2011];
long long ans;
int N, M;
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < N; ++i) scanf("%s", s[i]);
  for (int i = 0; i < (N); ++i) {
    for (int j = 0; j < (M); ++j)
      Left[i][j] = (j == 0 ? true : Left[i][j - 1]) && (s[i][j] != '#');
    for (int j = (M)-1; - 1 < j; --j)
      Right[i][j] = (j == M - 1 ? true : Right[i][j + 1]) && (s[i][j] != '#');
  }
  for (int j = 0; j < (M); ++j) {
    for (int i = 0; i < (N); ++i)
      Up[i][j] = (i == 0 ? true : Up[i - 1][j]) && (s[i][j] != '#');
    for (int i = (N)-1; - 1 < i; --i)
      Down[i][j] = (i == N - 1 ? true : Down[i + 1][j]) && (s[i][j] != '#');
  }
  for (int i = 1; i < N - 1; ++i) ans += Right[i][0];
  for (int i = 1; i < M - 1; ++i) ans += Down[0][i];
  for (int i = 1; i < N - 1; ++i)
    for (int j = 1; j < M - 1; ++j) {
      ans += Up[i][j] && Left[i][j];
      ans += Up[i][j] && Right[i][j];
      ans += Down[i][j] && Left[i][j];
      ans += Down[i][j] && Right[i][j];
    }
  for (int i = 1; i < N - 1; ++i) {
    int cnt = 0;
    for (int j = 1; j < M - 1; ++j) {
      if (s[i][j] != '#') {
        int add = (Up[i][j] ? 1 : 0) + (Down[i][j] ? 1 : 0);
        if (cnt) {
          ans += cnt * add;
          ans -= Up[i][j] && Up[i][j - 1];
          ans -= Down[i][j] && Down[i][j - 1];
        }
        cnt += add;
      } else
        cnt = 0;
    }
  }
  for (int j = 1; j < M - 1; ++j) {
    int cnt = 0;
    for (int i = 1; i < N - 1; ++i) {
      if (s[i][j] != '#') {
        int add = (Left[i][j] ? 1 : 0) + (Right[i][j] ? 1 : 0);
        if (cnt) {
          ans += cnt * add;
          ans -= Left[i][j] && Left[i - 1][j];
          ans -= Right[i][j] && Right[i - 1][j];
        }
        cnt += add;
      } else
        cnt = 0;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
