n = int(input()) S = input() P = list(map(int, input().split())) T = "" for p in P: T += S[p - 1] print(T)