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