Problem list
Log in
#r03217 · Online Judge > GoldOJ

Fruit Feast

Gold V 2.0 s 256 MB

Bessie's fullness starts at $0$ and must never exceed $T$. Eating an orange adds $A$, a lemon adds $B$ (both unlimited). At most once she may drink water, which halves her current fullness (rounding down). Print the maximum fullness $\le T$ she can reach.

Input

Three integers $T$, $A$, $B$ ($1 \le T \le 5,000,000$, $1 \le A, B \le T$).

Output

Print the maximum reachable fullness.

Example 1

Input
8 5 6
Output
8
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code