def fun(): _ = input() s = input() p = [int(x) - 1 for x in input().split()] return "".join([s[p[i]] for i, _ in enumerate(s)]) print(fun())