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