N,S,P=input(),input(),list(map(int,input().split())) print("".join([S[i-1] for i in P]))