n=int(input()) clist=list(map(int,input().split())) ans="" for i in reversed(range(9)): ans+=str(i+1)*clist(i) if ans=="": ans=0 print(int(ans))