There's an old saying - Hero may die but the king will never(英雄会死,而王绝不).
You may know that the hero is protecting the King, so he may die.
The King trains countless heros, and they will be attacked for M seconds. Every hero can be exposed to the attack of monster for at most S seconds. After a hero finishes his protecting, another hero will replace after at least B seconds.
For example, the King let hero A insist for 4 seconds, and at the 4th second, the hero A will back home and the next hero will go to protect the King at (4 + B)th second or later. That means, from 4th second to (4 + B)th second or more, the king will be exposed to the attack of the monster.
The king asks you to tell him how to arrange the heros that his damage will be minimum.
For each case, you should output the minimum damage the King will suffer.