You are given a string and supposed to do some string manipulations.
The first line of the input contains the initial string. You can assume that it is non-empty and its length does not exceed 1,000,000.
The second line contains the number of manipulation commands N (0 < N ≤ 2,000). The following N lines describe a command each. The commands are in one of the two formats below:
All characters in the input are digits or lowercase letters of the English alphabet.
For each Q command output one line containing only the single character queried.
ab 7 Q 1 I c 2 I d 4 I e 2 Q 5 I f 1 Q 3
a d e