#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
double pi = 2.0 * acos(0);
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
}
long long int max2(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int min2(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
long long int max3(long long int a, long long int b, long long int c) {
  return max2(a, max2(b, c));
}
long long int min3(long long int a, long long int b, long long int c) {
  return min2(a, min2(b, c));
}
void solve() {
  long long int n, m;
  cin >> n >> m;
  vector<long long int> row(n, 0);
  vector<long long int> col(m, 0);
  string s[n];
  for (long long int i = 0; i < n; i++) {
    cin >> s[i];
    for (long long int j = 0; j < m; j++) {
      if (s[i][j] == '*') {
        row[i]++;
        col[j]++;
      }
    }
  }
  long long int count = 0;
  long long int temp = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (s[i][j] == '*') {
        long long int r = row[i] - 1;
        long long int c = col[j] - 1;
        if (r > 0 && c > 0) {
          temp = (r * c);
          count += temp;
        }
      }
    }
  }
  cout << count << endl;
}
signed main(void) {
  fast();
  solve();
}

### Prompt

Please create a solution in cpp to the following problem:

You are given a n × m field consisting only of periods ('.') and asterisks ('*'). Your task is to count all right triangles with two sides parallel to the square sides, whose vertices are in the centers of '*'-cells. A right triangle is a triangle in which one angle is a right angle (that is, a 90 degree angle).

Input

The first line contains two positive integer numbers n and m (1 ≤ n, m ≤ 1000). The following n lines consist of m characters each, describing the field. Only '.' and '*' are allowed.

Output

Output a single number — total number of square triangles in the field. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).

Examples

Input

2 2
**
*.


Output

1


Input

3 4
*..*
.**.
*.**


Output

9

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
double pi = 2.0 * acos(0);
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
}
long long int max2(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int min2(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
long long int max3(long long int a, long long int b, long long int c) {
  return max2(a, max2(b, c));
}
long long int min3(long long int a, long long int b, long long int c) {
  return min2(a, min2(b, c));
}
void solve() {
  long long int n, m;
  cin >> n >> m;
  vector<long long int> row(n, 0);
  vector<long long int> col(m, 0);
  string s[n];
  for (long long int i = 0; i < n; i++) {
    cin >> s[i];
    for (long long int j = 0; j < m; j++) {
      if (s[i][j] == '*') {
        row[i]++;
        col[j]++;
      }
    }
  }
  long long int count = 0;
  long long int temp = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (s[i][j] == '*') {
        long long int r = row[i] - 1;
        long long int c = col[j] - 1;
        if (r > 0 && c > 0) {
          temp = (r * c);
          count += temp;
        }
      }
    }
  }
  cout << count << endl;
}
signed main(void) {
  fast();
  solve();
}

```