#abc258c. [abc258_c]Rotation
[abc258_c]Rotation
Problem Statement
You are given positive integers and , and a string of length consisting of lowercase English letters.
Process queries. Each query is of one of the following two types.
1 x
: Perform the following times in a row: delete the last character of and append it to the beginning.2 x
: Print the -th character of .
Constraints
- consists of lowercase English letters.
- At least one query in the format
2 x
. - , , are all integers.
Input
Input is given from Standard Input in the following format:
Each query is in the following format, where is or :
Output
For each query in the format 2 x
, print the answer in a single line.
Sample Input 1
Sample Output 1
In the -st query, is abc
, so the -nd character b
should be printed. In the -nd query, is changed from abc
to cab
. In the -rd query, is cab
, so the -nd character a
should be printed.