Ball Launcher#9052

Ball Launcher

1 secondo
128 megabyte
Facile

At a game fair, there is an automatic launcher that can throw up to balls before it needs to be refilled. The storage for balls always starts empty.

To play, you must launch exactly balls. You can either fully reload the launcher so it holds balls at once, which takes seconds, or add one ball at a time, each of which takes seconds. Each ball launch takes exactly one second. Of course, you can only launch balls when the launcher has them, and you cannot load new balls into a full storage.

Input

The first line contains four integers n, m, a and b~(1 \le n, m, a, b \le 10^4) — the number of balls to launch, the launcher storage size, the time to fully reload, and the time to add a single ball.

Output

Print one integer — the minimum time needed to launch exactly balls.

Esempi

Esempio

Input
3 2 4 3
Output
9

Esempio 1

Loading
Loading

Nota

In the sample, you should fully reload once, launch two balls, then insert one ball and launch it.