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;
struct segment {
  int l, r, fu;
  bool operator<(const segment &temp) const { return l < temp.l; }
};
segment sg[5000];
int cnt_sg;
const int inf = 1e9;
int xx[400], yy[400];
int cnt_x, cnt_y;
struct rectangle {
  int lx, ly, rx, ry;
};
rectangle rec[99];
int n, m, k, cnt, mc[1111][1111], nc[1111][11111], list[99], cnt_list, ls[99],
    cnt_ls;
long long ans, now;
char str[1111][1111];
bool vsx[400], vsy[400];
int main() {
  int i, j, s, p, q, id, dx1, dx2, dy1, dy2, lx, ly, rx, ry, pn;
  scanf("%d%d%d", &n, &m, &k);
  for (i = 0; i < n; i++) scanf("%s", str[i]);
  cnt = 0;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) {
      if (str[i][j] == '*' && !(i > 0 && str[i - 1][j] == '*') &&
          !(j > 0 && str[i][j - 1] == '*')) {
        rec[cnt].lx = i;
        rec[cnt].ly = j;
        for (s = i; s < n; s++) {
          for (p = j; p < m; p++) {
            if (str[s][p] != '*') break;
          }
          if (p == j) break;
          rec[cnt].ry = p - 1;
        }
        rec[cnt++].rx = s - 1;
      }
    }
  memset(mc, 0, sizeof(mc));
  memset(nc, 0, sizeof(nc));
  for (i = 0; i < k; i++) mc[rec[i].lx][rec[i].ly]++;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) {
      mc[i + 1][j] += mc[i][j];
      mc[i][j + 1] += mc[i][j];
      mc[i + 1][j + 1] -= mc[i][j];
    }
  cnt_x = cnt_y = 0;
  for (i = 0; i < k; i++) {
    xx[cnt_x++] = rec[i].lx;
    xx[cnt_x++] = rec[i].rx;
    if (rec[i].lx - 1 >= 0) xx[cnt_x++] = rec[i].lx - 1;
    if (rec[i].rx + 1 < n) xx[cnt_x++] = rec[i].rx + 1;
    yy[cnt_y++] = rec[i].ly;
    yy[cnt_y++] = rec[i].ry;
    if (rec[i].ly - 1 >= 0) yy[cnt_y++] = rec[i].ly - 1;
    if (rec[i].ry + 1 < m) yy[cnt_y++] = rec[i].ry + 1;
  }
  sort(xx, xx + cnt_x);
  sort(yy, yy + cnt_y);
  int nn = 0;
  for (i = 0; i < cnt_x; i++) {
    if (nn == 0 || xx[nn - 1] < xx[i]) xx[nn++] = xx[i];
  }
  cnt_x = nn;
  nn = 0;
  for (i = 0; i < cnt_y; i++) {
    if (nn == 0 || yy[nn - 1] < yy[i]) yy[nn++] = yy[i];
  }
  cnt_y = nn;
  ans = 0;
  for (i = 0; i < cnt_x; i++) {
    if (i == 0)
      dx1 = xx[i] + 1;
    else
      dx1 = xx[i] - xx[i - 1];
    for (j = i + 1; j <= cnt_x; j++) {
      if (j == cnt_x)
        dx2 = n - xx[j - 1];
      else
        dx2 = xx[j] - xx[j - 1];
      cnt_sg = 0;
      for (s = 0; s < k; s++) {
        if (rec[s].rx < xx[i] || rec[s].lx > xx[j - 1]) continue;
        if ((rec[s].rx >= xx[i] && rec[s].lx < xx[i]) ||
            (rec[s].rx > xx[j - 1] && rec[s].lx <= xx[j - 1]))
          sg[cnt_sg].fu = 1;
        else
          sg[cnt_sg].fu = 0;
        sg[cnt_sg].l = rec[s].ly;
        sg[cnt_sg++].r = rec[s].ry;
      }
      sort(sg, sg + cnt_sg);
      nn = 0;
      for (s = 0; s < cnt_sg; s++) {
        if (nn == 0 || sg[nn - 1].r < sg[s].l)
          sg[nn++] = sg[s];
        else if (sg[nn - 1].r < sg[s].r) {
          sg[nn - 1].r = sg[s].r;
          sg[nn - 1].fu = max(sg[nn - 1].fu, sg[s].fu);
        }
      }
      cnt_sg = nn;
      for (s = 1; s <= cnt_sg; s++) {
        if (s < cnt_sg)
          dy2 = sg[s].l - sg[s - 1].r;
        else
          dy2 = m - sg[s - 1].r;
        pn = 0;
        for (p = s - 1; p >= 0; p--) {
          lx = xx[i];
          ly = sg[p].l;
          rx = xx[j - 1];
          ry = sg[s - 1].r;
          int rs = mc[rx][ry];
          if (lx > 0) rs -= mc[lx - 1][ry];
          if (ly > 0) rs -= mc[rx][ly - 1];
          if (lx > 0 && ly > 0) rs += mc[lx - 1][ly - 1];
          if (rs > 3 || sg[p].fu == 1) break;
          if (rs == 0) continue;
          if (p == 0)
            dy1 = sg[p].l + 1;
          else
            dy1 = sg[p].l - sg[p - 1].r;
          for (q = 0; q < k; q++) {
            if (rec[q].lx >= lx && rec[q].rx <= rx && rec[q].ly >= ly &&
                rec[q].ry <= ry)
              continue;
            if (rec[q].lx <= rx && rec[q].rx >= xx[i] && rec[q].ly <= ry &&
                rec[q].ry >= ly)
              break;
          }
          if (q >= k) pn += dy1;
        }
        ans += (long long)pn * (long long)dy2 * (long long)dx1 * (long long)dx2;
      }
    }
  }
  printf("%I64d\n", ans);
  return 0;
}