Rohan got an array of numbers A from Mohan. Length of array A is n. Mohan asks Rohan to perform 2 different type of operations on array A. The operations are -
(i) Clockwise Rotation - In this operation, the element at index i moves to index (i+1) mod n
(ii) Anticlockwise Rotation - In this operation, the element at index i moves to index (i-1) mod n
Consider the given array as 0-indexed.
Given the initial array A and set of operations, you need to determine the resulting array.
Input Format
First line contains integer n, length of array A
Second line contains n space separated integers denoting the elements of array A
Third line contains integer Q, number of operation to be performed
Fourth line Q space separated integers denoting the set of operations
1 denotes anti-clockwise rotation, while 2 denotes clockwise rotation
Output Format
Output n space-separated integers which is the resulting array
Constraints
After each operation the rotation are as follows -
So the resulting array is 3, 4, 5. 1, 2