Vadim wants to buy a milk cocktail. He has N rubles. In the store, he noticed that the milk cocktail is on sale: one bottle costs A rubles, but if he buys at least X bottles, then each bottle will cost B rubles, and if he buys at least Y bottles, then each bottle will cost C rubles. What is the maximum number of bottles of milk cocktail Vadim can buy?
Input
Six integers are given in six lines, one per line. The numbers are given in the order N, A, X, B, Y, C (1 ≤ N ≤ 109, 1 ≤ C < B < A ≤ 109, 2 ≤ X < Y ≤ 109).
Output
Print the maximum number of bottles of milk cocktail that Vadim can buy.
Samples
| input | output |
|---|
400
104
4
92
6
82
| 4
|
500
104
4
92
6
82
| 6
|
Problem Author: Vadim Barinov
Problem Source: The 2026 ICPC UrFU Qualification