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