n,m = map(int, input().split())

S = []
C = []
for _ in range(m):
  s,c = map(int, input().split())
  S.append(s)
  C.append(c)

answer = 0
for i in range(m):
  answer += (10 ** (n - S[i]) )*C[i] 

print(answer)