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