a = int(input()) b = input() *c, = map(int, input().split()) print(''.join(b[d-1] for d in c))