AT_past202303_d シューティング
Description
You are playing a game, where you buy and use items to beat an enemy with stamina $ H $ . There are two kinds of items.
- Item $ 1 $ : when you use it, the enemy's stamina is reduced by $ A $ . The price is $ B $ yen (the currency in Japan).
- Item $ 2 $ : when you use it, the enemy's stamina is reduced by $ C $ . Let $ h $ be the resulting stamina. Then, if $ h>0 $ , the enemy's stamina is further reduced by $ \lfloor \frac{h}{2}\rfloor $ , where $ \lfloor A \rfloor $ denotes the value $ A $ rounded down to an integer.
An item disappears once you use it, but you may buy any number of the items. Also, you may use items in any order.
Find the minimum amount of money required to make the enemy's stamina $ 0 $ or less.
Input Format
The input is given from Standard Input in the following format:
> $ H $ $ A $ $ B $ $ C $ $ D $
Output Format
Print the answer.
Explanation/Hint
### Sample Explanation 1
You can buy one item $ 1 $ and one item $ 2 $ and use them in the following order:
- Use item $ 2 $ to reduce the enemy's stamina by $ 1 $ , making it $ 12 $ . Then, the enemy's stamina is further reduced by $ \lfloor \frac{12}{2}\rfloor=6 $ and becomes $ 6 $ .
- Use item $ 1 $ to reduce the enemy's stamina by $ 6 $ , making it $ 0 $ .
This way, you can make the enemy's stamina $ 0 $ or less. The total amount of money required is $ 5 + 7 = 12 $ , which we can prove is the minimum.
### Constraints
- $ 1\leq H,A,B,C,D \leq 10^9 $
- All values in the input are integers.