Problem
Fat people sit on numbered
N
chairs at a round table in the meeting room, each weight is known. Every hour they move in a circle to the right for one chair. Write a program that determines which fat person will be sitting in each chair after
R
hours.
Input
On the first line, enter the value
N
- a natural number (
\(N<=100\)). On the second line, enter
N
numbers - the weight of fat people (from
90
to
150
). In the third line, a natural number
R
(
\(0<=R<=100\)).
Imprint
Print in the first line the initial position of the fat people (their weight, starting from the one sitting on the first chair):
before: weight of fat people
In the second line, display the positions of the fat men after
R
hours:
after: weight of fat people
Examples
# |
Input |
Output |
1 |
5
98 127 139 141 107
3
|
before: 98 127 139 141 107
after: 139 141 107 98 127 |
Запрещенные операторы: insert
; pop
; del
; remove
; index