#CCBCHBAHAI0000034. Dịch đoạn [l, r] sang phải một bước (Right-Shift a Subarray [l, r] by One)
Dịch đoạn [l, r] sang phải một bước (Right-Shift a Subarray [l, r] by One)
Dịch đoạn [l, r] sang phải một bước (Right-Shift a Subarray [l, r] by One)
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given an integer array and indices satisfying
Within the segment only, perform one cyclic right shift. Every position outside the segment remains unchanged.
Let the result be . If , then . If , then
and
Print .
Input
The first line contains integers . The second line contains integers .
Output
Print the array after cyclically shifting segment one position to the right.
Subtask
Subtask 1 (100 points): ; ; .
Example
Input
7 1 4
10 20 30 40 50 60 70
Output
10 50 20 30 40 60 70
Explanation
The segment 20 30 40 50 becomes 50 20 30 40; the elements 10 60 70 are outside the segment and remain unchanged.