https://codeforces.com/problemset/problem/1409/C
Input Format
Check link
Output Format
Check link
Constraints
Check link
Example
Input
5 2 1 49 5 20 50 6 20 50 5 3 8 9 13 22
Output
1 49 20 40 30 50 10 26 32 20 38 44 50 8 23 18 13 3 1 10 13 4 19 22 25 16 7