Problem: You take part in the testing of new weapon. For the testing a polygon was created. The polygon is a rectangular field n × m in size, divided into unit squares 1 × 1 in size. The polygon contains k objects, each of which is a rectangle with sides, parallel to the polygon sides and entirely occupying several unit squares. The objects don't intersect and don't touch each other.

The principle according to which the weapon works is highly secret. You only know that one can use it to strike any rectangular area whose area is not equal to zero with sides, parallel to the sides of the polygon. The area must completely cover some of the unit squares into which the polygon is divided and it must not touch the other squares. Of course the area mustn't cross the polygon border. Your task is as follows: you should hit no less than one and no more than three rectangular objects. Each object must either lay completely inside the area (in that case it is considered to be hit), or lay completely outside the area.

Find the number of ways of hitting.

Input

The first line has three integers n, m и k (1 ≤ n, m ≤ 1000, 1 ≤ k ≤ 90) — the sizes of the polygon and the number of objects on it respectively. Next n lines contain m symbols each and describe the polygon. The symbol "*" stands for a square occupied an object, whereas the symbol "." stands for an empty space. The symbols "*" form exactly k rectangular connected areas that meet the requirements of the task.

Output

Output a single number — the number of different ways to hit a target.

Examples

Input

3 3 3
*.*
...
*..


Output

21


Input

4 5 4
.*.**
...**
**...
...**


Output

38


Input

2 2 1
.*
..


Output

4

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
char a[1005][1005];
int b[1005][1005];
int Q[2000005];
int L[105], R[105], D[105], U[105];
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
void go(int x, int y, int w) {
  b[x][y] = w;
  int qb = 0, qe = 0;
  L[w] = R[w] = x;
  D[w] = U[w] = y;
  Q[qe++] = x;
  Q[qe++] = y;
  while (qb < qe) {
    x = Q[qb++];
    y = Q[qb++];
    for (int k = 0; k < 4; k++)
      if (a[x + dx[k]][y + dy[k]] == '*' && b[x + dx[k]][y + dy[k]] == 0) {
        b[x + dx[k]][y + dy[k]] = w;
        L[w] = min(L[w], x + dx[k]);
        R[w] = max(R[w], x + dx[k]);
        U[w] = max(U[w], y + dy[k]);
        D[w] = min(D[w], y + dy[k]);
        Q[qe++] = x + dx[k];
        Q[qe++] = y + dy[k];
      }
  }
}
int n, m, k;
long long ans;
int LDY[1005], LUY[1005], LDX[1005], RDX[1005];
int RUX[1005], RUY[1005], gsum[1005];
void chk(int p, int q, int s) {
  int l, r, d, u, ll, rr, dd, uu;
  l = min(L[p], min(L[q], L[s]));
  r = max(R[p], max(R[q], R[s]));
  d = min(D[p], min(D[q], D[s]));
  u = max(U[p], max(U[q], U[s]));
  ll = 0;
  rr = n + 1;
  dd = 0;
  uu = m + 1;
  for (int i = 1; i <= k; i++) {
    if (i == p || i == q || i == s) continue;
    if (R[i] >= l && L[i] <= r) {
      if (U[i] < d)
        dd = max(dd, U[i]);
      else if (D[i] > u)
        uu = min(uu, D[i]);
      else
        return;
    }
    if (U[i] >= d && D[i] <= u) {
      if (R[i] < l)
        ll = max(ll, R[i]);
      else if (L[i] > r)
        rr = min(rr, L[i]);
      else
        return;
    }
  }
  for (int x = ll + 1; x <= l; x++) LDY[x] = dd + 1, LUY[x] = uu - 1;
  for (int y = dd + 1; y <= d; y++) LDX[y] = ll + 1, RDX[y] = rr - 1;
  for (int x = r; x < rr; x++) RUY[x] = uu - 1;
  for (int y = u; y < uu; y++) RUX[y] = rr - 1;
  for (int i = 1; i <= k; i++) {
    if (i == p || i == q || i == s) continue;
    if (R[i] < l && U[i] < d) {
      LDY[R[i]] = max(LDY[R[i]], U[i] + 1);
      LDX[U[i]] = max(LDX[U[i]], R[i] + 1);
    } else if (R[i] < l && D[i] > u) {
      LUY[R[i]] = min(LUY[R[i]], D[i] - 1);
    } else if (L[i] > r && U[i] < d) {
      RDX[U[i]] = min(RDX[U[i]], L[i] - 1);
    } else if (L[i] > r && D[i] > u) {
      RUY[L[i]] = min(RUY[L[i]], D[i] - 1);
      RUX[D[i]] = min(RUX[D[i]], L[i] - 1);
    }
  }
  for (int x = l - 1; x > ll; x--) {
    LDY[x] = max(LDY[x], LDY[x + 1]);
    LUY[x] = min(LUY[x], LUY[x + 1]);
  }
  for (int y = d - 1; y > dd; y--) {
    LDX[y] = max(LDX[y], LDX[y + 1]);
    RDX[y] = min(RDX[y], RDX[y + 1]);
  }
  for (int x = r + 1; x < rr; x++) RUY[x] = min(RUY[x], RUY[x - 1]);
  for (int y = u + 1; y < uu; y++) RUX[y] = min(RUX[y], RUX[y - 1]);
  gsum[r] = 0;
  for (int x = r + 1; x < rr; x++) gsum[x] = gsum[x - 1] + (RUY[x] - u + 1);
  for (int x = ll + 1; x <= l; x++)
    for (int y = LDY[x]; y <= d; y++) {
      int yu = LUY[x];
      int xr = RDX[y];
      int xyu = RUX[yu];
      if (xr <= xyu) {
        ans += 1LL * (yu - u + 1) * (xr - r + 1);
      } else {
        ans += 1LL * (yu - u + 1) * (xyu - r + 1) + gsum[xr] - gsum[xyu];
      }
    }
}
int main(void) {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
  int w = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (a[i][j] == '*' && b[i][j] == 0) {
        go(i, j, ++w);
      }
  ans = 0;
  for (int i = 1; i <= w; i++) chk(i, i, i);
  for (int i = 1; i <= w; i++)
    for (int j = i + 1; j <= w; j++) chk(i, j, j);
  for (int i = 1; i <= w; i++)
    for (int j = i + 1; j <= w; j++)
      for (int e = j + 1; e <= w; e++) chk(i, j, e);
  printf("%I64d\n", ans);
  return 0;
}