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