#K72157. Rotate List to the Right

    ID: 33691 Type: Default 1000ms 256MiB

Rotate List to the Right

Rotate List to the Right

You are given a list of integers and an integer k. Your task is to rotate the list to the right by k steps. In other words, move the last k elements of the list to the front while keeping the order of the elements intact.

If k is greater than the length of the list (n), then the effective number of rotations is given by $$k = k \mod n$$.

Please note that you must solve this problem using input from standard input (stdin) and output the result to standard output (stdout).

inputFormat

The first line contains an integer n representing the number of elements in the list. The second line contains n space-separated integers representing the list elements. The third line contains an integer k indicating the number of steps to rotate the list to the right.

outputFormat

Output the rotated list as space-separated integers on a single line.

## sample
6
1 2 3 4 5 6
3
4 5 6 1 2 3