N = int(input()) C = list(map(int,input().split())) ans = [] for i in range(8, -1, -1): if C[i] == 0: continue ans.append(str(i + 1) * C[i]) print("".join(ans))