n = int(input()) S = input() P = list(map(lambda x: int(x)-1, input().split())) print("".join([S[P[i]] for i in range(n)]))