Consider the sequence . If we use separators among those numbers, we get subsequences. Let be the sum of the elements of the -th subsequence. Let be the minimum , and let be the maximum . Given and , please choose where to place the separators so that is as small as possible.
Input consists of several cases, each one with and . You can assume and .
For every case, print lines. On the first line print the minimum . Afterwards, print a line for each of the subsequences, in order, with the numbers and their sum. Finally, print a line with 10 dashes. Follow exactly the format of the sample output. If there is more than one optimal solution, choose any one.
The expected solution is a dynamic programming. This problem could also be solved by precomputing the solutions. But, if you do that, your solution will be manually rejected.
Input
4 0 50 10
Output
0 1 + 2 + 3 + 4 = 10 ---------- 40 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 = 120 16 + 17 + 18 + 19 + 20 + 21 + 22 = 133 23 + 24 + 25 + 26 + 27 = 125 28 + 29 + 30 + 31 = 118 32 + 33 + 34 = 99 35 + 36 + 37 = 108 38 + 39 + 40 = 117 41 + 42 + 43 = 126 44 + 45 + 46 = 135 47 + 48 = 95 49 + 50 = 99 ----------