시간 제한
메모리 제한
시간 제한
1초
메모리 제한
128 MB
The first line of input contains a single integer P, (1 ≤ P ≤ 1000), which is the number of data sets that follow. Each data set consists of several lines. Each data set should be processed identically and independently.
The first line of each data set contains no more than the 93 distinct printable ASCII characters. The second line contains an integer, N (1 <= N <= 512), which is the number of integers on the next (fourth) line of the dataset. Each integer on the third line is in the range -X to X where X is the number of characters on the second line minus 1.
For each data set there is one correct line of output. It contains a string of length N made of the characters on the second line of the input data set.