Олимпиадный тренинг

Задача 38546. Sale


Stores for promotional purposes often arrange sales. For example, one of the major chains of stationery stores announced two promotional offers: "Buy N identical products and get one more product for free" and "Buy K products for the price of K&minus 1 product".

To hold the Olympiad, the organizers need to print out the conditions for the participants, which takes a lot of paper. Each pack costs B rubles. What is the maximum number of packs of paper that can be purchased for A rubles, using promotional offers correctly?

Input
The input file contains integers N, K, A and B (1 ≤ N ≤ 100, 2 ≤ K ≤ 100, 1 ≤ A ≤ 109, 1 ≤ B ≤ 109), separated by spaces.

Imprint
Print a single integer - the maximum number of packs of paper that the organizers of the Olympiad can buy.

Note
In the first example, using the second promotional offer twice, you can buy 8 packs of paper, paying for 6.

In the second example, promotional offers cannot be used.

In the third example, you can use each of the two promotional offers once and buy another pack of paper with the remaining ruble.
Examples
# Input Output
1 4 4 13 2 8
2 3 4 8 3 2
3 3 4 7 1 9