{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYou are given a string and supposed to do some string manipulations.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe 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.\u003c/p\u003e\u003cp\u003eThe second line contains the number of manipulation commands \u003ci\u003eN\u003c/i\u003e (0 \u0026lt; \u003ci\u003eN\u003c/i\u003e \u003cspan lang\u003d\"en-us\"\u003e≤\u003c/span\u003e 2,000). The following \u003ci\u003eN\u003c/i\u003e lines describe a command each. The commands are in one of the two formats below:\u003c/p\u003e\u003col\u003e\u003cli\u003e\u003ctt\u003eI ch p\u003c/tt\u003e: Insert a character \u003ci\u003ech\u003c/i\u003e before the \u003ci\u003ep\u003c/i\u003e-th character of the current string. If \u003ci\u003ep\u003c/i\u003e is larger than the length of the string, the character is appended to the end of the string.\u003c/li\u003e\u003cli\u003e\u003ctt\u003eQ p\u003c/tt\u003e: Query the \u003ci\u003ep\u003c/i\u003e-th character of the current string. The input ensures that the \u003ci\u003ep\u003c/i\u003e-th character exists.\u003c/li\u003e\u003c/ol\u003e\u003cp\u003eAll characters in the input are digits or lowercase letters of the English alphabet.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each \u003ci\u003eQ\u003c/i\u003e command output one line containing only the single character queried.\u003c/p\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003eab\r\n7\r\nQ 1\r\nI c 2\r\nI d 4\r\nI e 2\r\nQ 5\r\nI f 1\r\nQ 3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003ea\r\nd\r\ne\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}