In cryptography a cipher ( or cypher ) is an algorithm for performing encryption or decryption-a series of well-defined steps that can be followed as a procedure. An alternative, less common term is encipherment. To encipher or encode is to convert information into cipher or code. In common parlance, “cipher” is synonymous with code, as they are both a set of steps that encrypt a message; however, the concepts are distinct in cryptography, especially classical cryptography.
In this problem you have to implement one basic encryption method. You will be given a NN x MMmatrix and a string SS containing uppercase English letters only along with an instruction set containing MM number of instructions. Each instruction of the instruction set will contain one uppercase character UU or DD followed by an integer KK. For iith instruction of the instructions set, you have to shift each character of matrix’s iith column KK times upward if the iith instruction’s character is UU. Otherwise, you have to shift each character of matrix’s iith column KK times downward. Note that the matrix is circular that means it’s first row is connected with it’s last one.
First line contains an integer TT , numbers of test cases. ( 1 <= T <= 10001<=T<=1000 ). For each test case,The first line will contain two integers NN ( 1 <= N <= 1001<=N<=100 ) and MM ( 1 <= M <= 10001<=M<=1000 ) numbers of row and column of the matrix. Second line will contain a string SS ( 1 <= | S | <= N1<=∣S∣<=NxMM ) containing uppercase letters only. Then there will be MM lines of instruction to be performed on the matrix. Each line contains one uppercase character U or D followed by an integer KK ( 0 <= K <= 1000000<=K<=100000 )
Output the string after encryption operation.