output_description: Print an integer representing the minimum number of minutes needed to make N
  pieces of takoyaki.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N X T
attempt: H, W, M = map(int, input().split())
  row_boms = [0 for i in range(H)]
  col_boms = [0 for i in range(W)]
  
  boms = [[0 for j in range(W)] for i in range(H)]
  for i in range(M):
      h, w = map(int, input().split())
      boms[h - 1][w - 1] = 1
      row_boms[h - 1] += 1
      col_boms[w - 1] += 1
  
  row_max = max(row_boms)
  col_max = max(col_boms)
  
  rowmax_h = []
  colmax_w = []
  for i in range(H):
      if row_boms[i] == row_max:
          rowmax_h += [i]
  for i in range(W):
      if col_boms[i] == col_max:
          colmax_w += [i]
  rows = len(rowmax_h)
  cols = len(colmax_w)
  tf = 0
  for i in rowmax_h:
      for j in colmax_w:
          if boms[i][j] == 0:
              tf = 1
              break
  
  if tf == 1:
      print(row_max + col_max)
  else:
      print(row_max + col_max - 1)
  
problem_description: Statement
  
  Takahashi loves takoyaki - a ball-shaped snack.
  
  With a takoyaki machine, he can make at most X pieces of takoyaki at a time,
  taking T minutes regardless of the number of pieces to make.
  
  How long does it take to make N takoyaki?
samples: [{"input": "20 12 6", "output": "12\n    \n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the\nnext 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1\nminute.\n\n* * *"}, {"input": "1000 1 1000", "output": "1000000\n    \n\nIt seems to take a long time to make this kind of takoyaki."}]