n = int(input()) import itertools if n == 1: for p in itertools.permutations(range(10), 7): a = str(p[0])+str(p[1])+str(p[2]) b = str(p[3])+str(p[4])+str(p[5]) c = str(p[1])+str(p[6])+str(p[2])+str(p[1]) if a[0] == '0' or b[0] == '0' or c[0] == '0': continue if int(a)+int(b) == int(c): #print(a) #print(b) print(c) exit() elif n == 2: for p in itertools.permutations(range(10), 10): a = str(p[0])+str(p[0])+str(p[1])+str(p[2]) b = str(p[3])+str(p[4])+str(p[5])+str(p[6]) c = str(p[7])+str(p[8])+str(p[1])+str(p[2])+str(p[9]) if a[0] == '0' or b[0] == '0' or c[0] == '0': continue if int(a)+int(b) == int(c): #print(a) #print(b) print(c) exit() else: for p in itertools.permutations(range(10), 10): a = str(p[0])+str(p[1])+str(p[2])+str(p[3])+str(p[4])+str(p[5]) b = str(p[6])+str(p[3])+str(p[5])+str(p[7])+str(p[8]) c = str(p[1])+str(p[3])+str(p[9])+str(p[4])+str(p[3])+str(p[9]) if a[0] == '0' or b[0] == '0' or c[0] == '0': continue if int(a)+int(b) == int(c): #print(a) #print(b) print(c) exit()