10423 - String swapping   

Description

The first line of the input is a string.
You may read it using scanf() with %s format.

The second line of the input contains a list of positive integers and ends with a #.
You may read it using
    while(scanf("%d", &num[i])==1) i++;

Example:

ABCDEFGHIJ
5 3 8 6 #

The first number 5 means that we need to swap the first five characters with the remaining characters in the input string. After performing this operation, the original string, which is ABCDEFGHIJ, will become FGHIJABCDE.

The next number is 3, so the string becomes IJABCDEFGH.
The next number is 8, and the string becomes GHOJABCDEF.
The final number is 6, so the output string is CDEFGHIJAB.

Input

The first line is a string. Its length is from 2 to 10.
The second line is a list of positive integers. There are at most 20 integers.

Output

Print the final string after performing all operations.
You do not need to print a newline at the end. (No '\n')

Sample Input  Download

Sample Output  Download

Tags




Discuss