n,m = map(int, input().split())
sc = [ list(map(int,input().split())) for _ in range(m)]

ans = [0] * n
if n >= 2:
    ans[0]=1
for i in range(n):
    for j in range(m):
        if i+1 == sc[j][0]:
            ans[i] = sc[j][1]

answer = ''
for i in range(len(ans)):
    answer += str(ans[i])

print(int(answer))
