n=int(input()) s=input() p=list(map(int,input().split())) print("".join(s[p[i]-1] for i in range(n)))