output_description: Print the number of blocks in K-city.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      n m
attempt: H, W = map(int, input().split())
  N = int(input())
  a = list(map(int, input().split()))
  i = 0
  s = ["" for j in range(H)]
  for y in range(H):
      for x in range(W):
          if x != 0:
              s[y] = s[y] + " "
          s[y] = s[y] + str(i + 1)
          a[i] = a[i] - 1
          if a[i] == 0:
              i = i + 1
      if y % 2 == 0:
          print(s[y])
      else:
          print(" ".join(s[y].split()[::-1]))
  
problem_description: Statement
  
  In _K-city_ , there are n streets running east-west, and m streets running
  north-south. Each street running east-west and each street running north-south
  cross each other. We will call the smallest area that is surrounded by four
  streets a block. How many blocks there are in K-city?
samples: [{"input": "3 4", "output": "6\n    \n\nThere are six blocks, as shown below:\n\n![9179be829dc9810539213537d4c7398c.png](https://atcoder.jp/img/abc069/9179be829dc9810539213537d4c7398c.png)\n\n* * *"}, {"input": "2 2", "output": "1\n    \n\nThere are one block, as shown below:\n\n![997bfafa99be630b54d037225a5c68ea.png](https://atcoder.jp/img/abc069/997bfafa99be630b54d037225a5c68ea.png)"}]