4907: Guest From the Past 来自过去的嘉宾

内存限制:256 MB 时间限制:2 S
题面:传统 评测方式:文本比较 上传者:
提交:5 通过:4

题目描述

科利亚·格拉西莫夫非常喜欢开菲尔。他生活在1984年,知道购买这种美味饮料的所有细节。有一天,你可能知道,他发现自己在 2084 年,在那里购买开菲尔要复杂得多。

科利亚饿了,所以他去了最近的牛奶店。在 2084 年,您可能会购买塑料升瓶中的开菲尔,价格为 a 卢布,或者玻璃升瓶,价格为 b 卢布。此外,您可以退回空玻璃瓶并获得 c (c < b) 卢布,但您不能退回塑料瓶。

科利亚有 n 卢布,他真的很饿,所以他想尽可能多地喝开菲尔。他的1984年没有塑料瓶,所以科利亚不知道如何采取最佳行动并寻求您的帮助。

Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more complicated.
Kolya is hungry, so he went to the nearest milk shop. In 2084 you may buy kefir in a plastic liter bottle, that costs a rubles, or in glass liter bottle, that costs b rubles. Also, you may return empty glass bottle and get c (c<b) rubles back, but you cannot return plastic bottles.
Kolya has n rubles and he is really hungry, so he wants to drink as much kefir as possible. There were no plastic bottles in his 1984, so Kolya doesn't know how to act optimally and asks for your help.
Input
First line of the input contains a single integer n (1≤n≤1018)− the number of rubles Kolya has at the beginning.
Then follow three lines containing integers a, b and c (1≤a≤1018, 1≤c<b≤1018)− the cost of one plastic liter bottle, the cost of one glass liter bottle and the money one can get back by returning an empty glass bottle, respectively.
Output
Print the only integer− maximum number of liters of kefir, that Kolya can drink.
Examples
Input
10
11
9
8
Output
2
Input
10
5
6
1
Output
2
Note
In the first sample, Kolya can buy one glass bottle, then return it and buy one more glass bottle. Thus he will drink 2 liters of kefir.
In the second sample, Kolya can buy two plastic bottle and get two liters of kefir, or he can buy one liter glass bottle, then return it and buy one plastic bottle. In both cases he will drink two liters of kefir.

输入格式

输入的第一行包含一个整数 n(1 ≤ n ≤ 1018) — Kolya 开头的卢布数。

然后遵循包含整数 a、b 和 c 的三行(1 ≤ a ≤ 10 18、1 ≤ c < b ≤ 10 18)——一塑料升瓶的成本、一升玻璃瓶的成本和归还空玻璃瓶可以取回的钱。

输出格式

打印唯一的整数 - 科利亚可以喝的最大升开菲尔。

输入样例 复制

10
11
9
8

输出样例 复制

2

数据范围与提示

在第一个样品中,Kolya 可以买一个玻璃瓶,然后退回并再买一个玻璃瓶。因此,他将喝 2 升开菲尔。

在第二个样本中,Kolya 可以买两个塑料瓶并获得两升开菲尔,或者他可以买一升玻璃瓶,然后退回并购买一个塑料瓶。在这两种情况下,他都会喝两升开菲尔。