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