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: from collections import Counter
  
  pas = 0
  
  H, W, M = map(int, input().split())
  hn = []
  wn = []
  tli = []
  for _ in range(M):
      h, w = map(int, input().split())
      tli.append([h, w])
      hn.append(h)
      wn.append(w)
  
  hcnt = Counter(hn)
  wcnt = Counter(wn)
  
  ha, cha = zip(*hcnt.most_common())
  wa, cwa = zip(*wcnt.most_common())
  
  hli = [int(ha[0])]
  wli = [int(wa[0])]
  for i in range(len(cha) - 1):
      if cha[i] == cha[i + 1]:
          hli.append(int(ha[i + 1]))
      else:
          break
  for i in range(len(cwa) - 1):
      if cwa[i] == cwa[i + 1]:
          wli.append(int(wa[i + 1]))
      else:
          break
  
  for i in range(len(hli)):
      if pas == 1:
          break
      for k in range(len(wli)):
          if [hli[i], wli[k]] not in tli:
              ans = cha[i] + cwa[k]
              pas = 1
              break
  
  if pas == 0:
      print(cha[0] + cwa[0] - 1)
  else:
      print(ans)
  
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."}]