I=input N=I() S=I() print("".join(S[int(p)-1]for p in I().split()))