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