#C9048. Rotate Array

    ID: 53098 Type: Default 1000ms 256MiB

Rotate Array

Rotate Array

You are given an array of integers and an integer \(K\). Your task is to rotate the array clockwise by \(K\) steps. Rotating the array means moving the last \(K\) elements of the array to the beginning while keeping the order of the elements unchanged.

For example, if the array is [1, 2, 3, 4, 5] and \(K = 2\), then after rotation the array becomes [4, 5, 1, 2, 3]. Note that if \(K\) is greater than the size of the array \(n\), the actual number of steps is \(K \mod n\). That is, only the remainder after dividing \(K\) by \(n\) is taken into account.

You are required to read the input from stdin and write the output to stdout.

inputFormat

The first line contains a single integer \(n\) representing the number of elements in the array.

The second line contains \(n\) space-separated integers representing the elements of the array.

The third line contains a single integer \(K\) denoting the number of steps to rotate the array.

The input is provided via stdin.

outputFormat

Output the rotated array as a sequence of space-separated integers on a single line.

The output should be written to stdout.

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