Raman is very hungry

0

0 votes
Medium
Problem

Raman is in Rajat's room and has discovered a pile of oranges and a pile of apples in his bag ( unlimited number of each, yes rajat has a very large bag), and he is determined to eat as much as possible.

Raman has a maximum fullness of F.Eating an orange increases his fullness by X, and eating an apple increases his fullness by Y . Additionally, if he wants, Raman can drink water at most one time, which will reduce his fullness to half (will round down) instantly.

Help Raman determine the maximum fullness that he can achieve .

Input Format

The first and only line has 3 space separated integers F,X and Y.

Constraints

1F5000000

1X,YF

Output Format

Output one line of integer the maximum fullness that raman can achieve.

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Raman can achieve maximum fullness of 10

Eat orange ,then drink water and then eat apple.

Editor Image

?