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