Problem: An array is called to be a subarray of if it forms a continuous subsequence of , that is, if it is equal to , , , for some .
Suppose is some known constant. For any array, having or more elements, let's define it's beauty as the sum of largest elements of that array. For example:
- For array and , the largest elements of are , and , so the beauty of is .
- For array and , the beauty of is .
You are given an array , the value of the said constant and an integer . Your need to split the array into exactly subarrays such that:
- Each element from belongs to exactly one subarray.
- Each subarray has at least elements.
- The sum of all beauties of subarrays is maximum possible.
Input Format: The first line contains three integers , and (, , , ) — the number of elements in , the constant in the definition of beauty and the number of subarrays to split to.
The second line contains integers ().
Output Format: In the first line, print the maximum possible sum of the beauties of the subarrays in the optimal partition.
In the second line, print integers () representing the partition of the array, in which:
- All elements with indices from to belong to the first subarray.
- All elements with indices from to belong to the second subarray.
- .
- All elements with indices from to belong to the last, -th subarray.
If there are several optimal partitions, print any of them.
Note: In the first example, one of the optimal partitions is , , .
- The beauty of the subarray is .
- The beauty of the subarray is .
- The beauty of the subarray is .
The sum of their beauties is .
In the second example, one optimal partition is , , , .