#76Medium
Cyclic shift
Time: 1 s · Memory: 256 MB
- Arrays
Statement
Cyclically shift an array of numbers by steps to the right: on each step the last element moves to the front and the others move one position right. For example, 1 2 3 becomes 3 1 2 after one step.
Input format
The first line contains and (, ). The second line contains integers ().
Output format
A single line with numbers — the shifted array.
Examples
Input
6 2 2 4 6 8 10 12
Output
10 12 2 4 6 8
Input
3 7 1 2 3
Output
3 1 2
Note
Shifting by steps brings the array back, so is enough instead of — doing steps one by one would take too long. Element goes to position in the new array. In the second example : 3 1 2.
