N=int(input()) S=input() P=list(map(int, input().split())) res = '' for p in P: res += S[p-1] print(res)