CF625A.Guest From the Past

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 aa rubles, or in glass liter bottle, that costs bb rubles. Also, you may return empty glass bottle and get cc ( c<b ) rubles back, but you cannot return plastic bottles.

Kolya has nn 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.

输入格式

First line of the input contains a single integer nn ( 1<=n<=10181<=n<=10^{18} ) — the number of rubles Kolya has at the beginning.

Then follow three lines containing integers aa , bb and cc ( 1<=a<=10181<=a<=10^{18} , 1<=c<b<=10^{18} ) — 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.

输出格式

Print the only integer — maximum number of liters of kefir, that Kolya can drink.

输入输出样例

  • 输入#1

    10
    11
    9
    8
    

    输出#1

    2
    
  • 输入#2

    10
    5
    6
    1
    

    输出#2

    2
    

说明/提示

In the first sample, Kolya can buy one glass bottle, then return it and buy one more glass bottle. Thus he will drink 22 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.

首页