A playlist is a singly linked chain of track IDs given head to tail. Rotate the chain to the right by k positions: each rotation by one moves the last node to the front. Because rotating by the length returns the original chain, only k mod n effective rotations matter. Print the resulting chain.
Input format
Line 1: an integer n, the number of tracks (n >= 1).
Line 2: n space-separated integers, the track values from head to tail.
Line 3: an integer k, the number of right rotations.
Output format
Line 1: the number of tracks, n.
Line 2: the values after rotating right by k, space-separated.
Constraints
- 1 <= n <= 100000
- 0 <= k <= 1000000000
- -1000000000 <= each value <= 1000000000