Skip to main content
LIVE CONTEST: ALGOR Contest: Round #4 (Special Challenge) is live now!

~/algor $ cat problems/massiv-ongga-siklik-surish

Cyclic shift right by 1

Easy 1000 ms 128 MB 31%
Share

A positive integer $n$ and an array of $n$ integers are given. Cyclically shift the array elements by $1$ position to the right (the last element moves to the first place) and print the resulting array.

Cyclic shift of the array elements one step to the right

Input

The first line contains a positive integer $n$. The second line contains $n$ integers separated by spaces.

Output

One line with $n$ integers separated by spaces.

Note

$1 \le n \le 1000$
$-10^{9} \le a_{i} \le 10^{9}$

Examples

Input #1
5
10 20 30 40 50
Output #1
50 10 20 30 40
Input #2
3
1 2 3
Output #2
3 1 2

Sign in to submit a solution

Signing up is free and takes a minute.