n = int(input()) s = input() P = list(map(int, input().split())) T = [] for i in P: T.append(s[i - 1]) print("".join(T))