def main(): _ = int(input()) arr = list(map(int, input().split())) ans = "" for i in range(8, -1, -1): if arr[i] != 0: ans += str(i + 1) * arr[i] print(ans) if __name__ == "__main__": main()