题目链接:点击打开链接

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 515;
char s[N];
int main() {
	int T, cas, n, m, x;
	scanf("%d", &T);
	while(T-- > 0) {
		scanf("%d", &cas);getchar();
		gets(s); 
		int n = strlen(s);
		
		scanf("%d", &m); printf("%d ", cas);
		int pos = 0;
		while(m-- > 0) {
			scanf("%d", &x);
			pos += x;
	//		printf("%d,", pos);
			pos = (pos % n + n) % n;
	//		if(pos > -n && pos < n) printf("%c\n", s[(pos+n)%n]);
			printf("%c", s[pos]);
		} puts("");
	}

	return 0;
}
/*

3
G.IETSNPRBU
17
2 4 5 -6 -1 -3 -2 -4 -4 1 -1 5 -3 4 1 -2 4

5
D^obV@k"W*B&#]4!NcF$'lj%(d6XG5fi<Hxz7)2Lt~=8aQuvh}r_m+C9eI`-.>EwYyngZRsJKpqO{[\U|MPS,;T?031/A
93
-1 11 44 39 -31 -44 10 5 24 14 1 -33 42 28 -34 7 -37 24 14 3 -7 18 4 19 37 4 20 2 41 -42 18 15 -3 10
7 12 -11 -41 14 8 31 -26 37 -19 -17 -9 -16 15 31 14 29 -22 1 -24 20 -30 6 1 16 -29 31 -30 6 17 -43
-10 7 7 4 -22 10 -2 15 13 14 2 6 -17 34 -27 28 29 -28 2 33 -13 -15 6 -31 24 41 29 26
*/