A mountain in Ddasland consists of positions. Initially, the height of position is .
Dadas has bombs. Bomb can be used on the interval and costs . When it is used, the current height of every position in the interval becomes .
Each bomb may be used at most once. Bombs may be left unused, and they may be used in any order.
Find the minimum total cost required to make every height equal to . If this is impossible, print .
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
Output
For each test case, print the minimum total cost required to make every height equal to on one line.
If it is impossible, print .
Constraints
- .
- .
- .
- ().
- ().
- ().
- The sum of over all test cases does not exceed .
- The sum of over all test cases does not exceed .
Subtasks
Samples
In the first test case, using bombs and makes every height equal to with total cost .
In the second test case, no bomb covers the second position, so it is impossible.
In the third test case, every height is already , so the answer is .