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