Intuit | onsite | Aman and Coding | Hard
Aman and Coding
Hard
Aman is learning to code again after a break of 6 months. Now aman is provided with n questions in a test and he is lazy so he wrote codes for every question but didn't complete most of the codes. We are provided with number of lines of code he wrote for every question. If he writes "m" lines of code for any question, that question is solved and he need not write any more lines of code for that.
Now aman can write "c" more lines of code before he will go to sleep. Score of test is sum of following value.
Now as aman will write only "c" more lines of code, help him decide in which questions he should write these lines of code.
You should output the maximum score of test possible and n integers representing the final number of lines of code for every question.
Constraints
11<=n<=100000
21<=m<=100000000
30<=cf<=1000
40<=pf<=1000
50<=m<=1000000000000000Format
Input
The first line contains five space separated integers
The second line will contain n space separated integers representing the number of lines of code he already wrote for every question.
Output
In first line output the maximum test score aman can get.
In second line print n integers representing the final number of lines of code for every
question.
Example
Sample Input
14 6 12 1 7
21 3 1 1Sample Output
114
22 6 2 2