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
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.