#include <bits/stdc++.h>
using namespace std;
const long long N = 1010;
long long hori[N][N], miya[N][N], a[N][N], n, m, ans;
inline void calc_r() {
  memset(hori, 0, sizeof(hori));
  for (long long i = m; i >= 1; i--)
    for (long long j = 1; j <= n; j++)
      hori[j][i] = hori[j][i + 1] + a[j][i + 1];
}
inline void calc_l() {
  memset(hori, 0, sizeof(hori));
  for (long long i = 1; i <= m; i++)
    for (long long j = 1; j <= n; j++)
      hori[j][i] = hori[j][i - 1] + a[j][i - 1];
}
inline void calc_up() {
  memset(miya, 0, sizeof(miya));
  for (long long i = 1; i <= m; i++) {
    for (long long j = 1; j <= n; j++) {
      miya[j][i] = miya[j - 1][i] + hori[j - 1][i] * a[j - 1][i];
      if (a[j][i]) ans += miya[j][i];
    }
  }
}
inline void calc_down() {
  memset(miya, 0, sizeof(miya));
  for (long long i = 1; i <= m; i++) {
    for (long long j = n; j >= 1; j--) {
      miya[j][i] = miya[j + 1][i] + hori[j + 1][i] * a[j + 1][i];
      if (a[j][i]) ans += miya[j][i];
    }
  }
}
signed main() {
  cin >> n >> m;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) {
      char c;
      cin >> c;
      a[i][j] = c == '*';
    }
  calc_r();
  calc_up();
  calc_down();
  calc_l();
  calc_up();
  calc_down();
  cout << ans << '\n';
}
