output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      H
      W
attempt: h, w = map(int, input().split())
  lis = [str(input()) for i in range(h)]
  ans = 0
  ch = [[0] * w for i in range(h)]
  
  
  def firstcheck(x, y):
      if lis[x][y] != "#" or ch[x][y] != 0:
          return False
      if x > 0:
          if lis[x - 1][y] == ".":
              return True
      if x < h - 1:
          if lis[x + 1][y] == ".":
              return True
      if y > 0:
          if lis[x][y - 1] == ".":
              return True
      if y < w - 1:
          if lis[x][y + 1] == ".":
              return True
      return False
  
  
  for sx in range(h):
      for sy in range(w):
          if firstcheck(sx, sy):
              cnt = 1
              nu = 0
              ch[sx][sy] = 1
              num = [[0] * w for i in range(h)]
              now = {(sx, sy, 1)}
              while len(now) != 0:
                  tmp = set()
                  for x, y, iro in now:
                      if x > 0:
                          if lis[x - 1][y] != lis[x][y] and num[x - 1][y] == 0:
                              nu += iro
                              tmp.add((x - 1, y, (iro + 1) % 2))
                              num[x - 1][y] = 1
                              if lis[x - 1][y] == "#" and ch[x - 1][y] == 0:
                                  cnt += 1
                                  ch[x - 1][y] = 1
                      if x < h - 1:
                          if lis[x + 1][y] != lis[x][y] and num[x + 1][y] == 0:
                              nu += iro
                              tmp.add((x + 1, y, (iro + 1) % 2))
                              num[x + 1][y] = 1
                              if lis[x + 1][y] == "#" and ch[x + 1][y] == 0:
                                  cnt += 1
                                  ch[x + 1][y] = 1
                      if y > 0:
                          if lis[x][y - 1] != lis[x][y] and num[x][y - 1] == 0:
                              nu += iro
                              tmp.add((x, y - 1, (iro + 1) % 2))
                              num[x][y - 1] = 1
                              if lis[x][y - 1] == "#" and ch[x][y - 1] == 0:
                                  cnt += 1
                                  ch[x][y - 1] = 1
                      if y < w - 1:
                          if lis[x][y + 1] != lis[x][y] and num[x][y + 1] == 0:
                              nu += iro
                              tmp.add((x, y + 1, (iro + 1) % 2))
                              num[x][y + 1] = 1
                              if lis[x][y + 1] == "#" and ch[x][y + 1] == 0:
                                  cnt += 1
                                  ch[x][y + 1] = 1
                  now = tmp
              ans += nu * cnt
  print(ans)
  
problem_description: Statement
  
  It has been decided that a programming contest sponsored by company A will be
  held, so we will post the notice on a bulletin board.
  
  The bulletin board is in the form of a grid with N rows and N columns, and the
  notice will occupy a rectangular region with H rows and W columns.
  
  How many ways are there to choose where to put the notice so that it
  completely covers exactly HW squares?
samples: [{"input": "3\n    2\n    3", "output": "2\n    \n\nThere are two ways to put the notice, as follows:\n\n    \n    \n    ###   ...\n    ###   ###\n    ...   ###\n    \n\nHere, `#` represents a square covered by the notice, and `.` represents a\nsquare not covered.\n\n* * *"}, {"input": "100\n    1\n    1", "output": "10000\n    \n\n* * *"}, {"input": "5\n    4\n    2", "output": "8"}]