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