cho.sh
Notes
Loading...

Two-Bill Purchase

Time limit

0.5s

Memory limit

128 MB

Problem

You can pay using only two kinds of bills: bills worth P and bills worth Q. You may use as many bills of each kind as needed.

An item costs D. To buy it, the amount paid must be at least D. Find the smallest amount that can be paid.

Input

The first line contains D, P, and Q separated by spaces. Each value is a natural number not greater than 10^9.

Output

Print the minimum amount that can be paid to buy the item.