N = int(input()) S = input() L = list(map(int, input().split())) L = [x-1 for x in L] T = '' for i in range(N): T += S[L[i]] print(T)