ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

ICPC UrFU Contest Qualifier 2026

About     Problems     Submit solution     Judge status     Standings
Contest is over

A. Cocktail

Time limit: 0.5 second
Memory limit: 256 MB
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

inputoutput
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