403547: GYM101192 I Abacaba Ltd.

Memory Limit:64 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Abacaba Ltd.time limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard output

Yasha is a young businessman who has read lots of marketing books. He decided to give his company a name that it will be the first in the alphabetical list of organizations of the city. But the city council is tired of all these endless "Abacaba Ltd."-s. So they gave Yasha a random string as the name for his company, in which he must do exactly one modification. Modification is done by swapping any two characters such that the distance between them is equal to any of the favorite numbers of the head of the city council. The distance is calculated as absolute difference of positions of characters in the string. It is guaranteed that such modification is possible.

Input

The first line contains string s — the initial random name. It consists of small latin letters. The second line contains one integer number n —the amount of the favorite numbers of the head of the city council. The next line has n integer numbers ai.

2 ≤ |S| ≤ 105
1 ≤ n ≤ 50
1 ≤ ai < |S|
Output

Output the name of the company that want to choose.

ExampleInput
acdbe
2
4 2
Output
abdce

加入题单

上一题 下一题 算法标签: