{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"I am retired now, so no work, a lot of time to spare and a lot of problems to share. Well, I am thinking of the old days when I was a problem solver as I am stuck with a tough problem that I want to share with you.\n\nGiven an array and some operations on the array, you have to print the final state of the array. Say, the array is `a[]`, the size is **n** and indexed from **0** to **n-1**. The operations are:\n\n1. `S D`. **D** is an integer. **D** will be added with all the elements of the array.\n2. `M D`. **D** is an integer. All the elements of the array will be multiplied by **D**.\n3. `D K`. **K** is a non zero integer. All the elements of the array will be divided by **K**(integer division).\n4. `P Y Z`. **Y**and **Z** are integers. It will swap the elements **a[Y]** and **a[Z]**.\n5. `R`. Reverses the array, i.e `[1, 2, 4, 3]`, becomes `[3, 4, 2, 1]`."}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026#8804; 100)**, denoting the number of test cases.\n\nEach case contains two integers **n (1 \u0026#8804; n \u0026#8804; 100)** and **m (0 \u0026#8804; m \u0026#8804; 101)**. The next line contains **n** space separated integers denoting the elements of the array. Each of the next **m** lines contains an operation defined above. You can assume that no operation will overflow/underflow the 32 bit signed integer range or access any invalid array reference."}},{"title":"Output","value":{"format":"MD","content":"For each case, print the case number first. In the next line you have to print the elements of the array. Two elements should be separated by a single space. There should be no trailing space after the last integer of the array."}},{"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\u003e2\n5 3\n1 2 3 4 5\nP 0 1\nS 1\nR\n4 2\n2 7 8 1\nM 10\nD 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1:\n6 5 4 2 3\nCase 2:\n4 14 16 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}