output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: import sys
  
  ar = []
  x = sys.stdin.readline()
  x = x.split(" ")
  (n, m) = [int(str) for str in x]
  
  ret = 0
  chk = []
  for i in range(m):
      x = sys.stdin.readline()
      x = x.split(" ")
      (s, c) = [int(str) for str in x]
      if not (s in chk):
          if n - s >= 0:
              ret += c * 10 ** (n - s)
              chk.append(s)
      else:
          if c != int(ret / 10 ** (n - s)):
              print("-1")
              exit(0)
  
  
  if ret == 0 and n == 1:
      print("0")
      exit(0)
  if ret < 10 ** (n - 1):
      if not (n - 1 in chk):
          print(ret + 10 ** (n - 1))
      else:
          print("-1")
  else:
      print(ret)
  sys.stdout.flush()
  
problem_description: Statement
  
  Takahashi wants to print a document with N pages double-sided, where two pages
  of data can be printed on one sheet of paper.
  
  At least how many sheets of paper does he need?
samples: [{"input": "5", "output": "3\n    \n\nBy printing the 1-st, 2-nd pages on the 1-st sheet, 3-rd and 4-th pages on the\n2-nd sheet, and 5-th page on the 3-rd sheet, we can print all the data on 3\nsheets of paper.\n\n* * *"}, {"input": "2", "output": "1\n    \n\n* * *"}, {"input": "100", "output": "50"}]