n = int(input()) c1,c2,c3,c4,c5,c6,c7,c8,c9 = map(int,input().split()) print("9"*c9+"8"*c8+"7"*c7+"6"*c6+"5"*c5+"4"*c4+"3"*c3+"2"*c2+"1"*c1)