N = int(input()) S = input() P = list(map(int, input().split())) print("".join([S[p-1] for p in P]))