407440: GYM102791 F Deposit
Description
Monocarp saved up $$$n$$$ burles and decided to deposit all his $$$n$$$ burles in a local bank.
Unfortunately, Monokarp hasn't read the license agreement, that's why now he has only two types of operations with money in the deposit (fortunately, he can make any number of operations of each type):
- withdraw $$$a$$$ burles from the bank account (he can make this operation only if he stores at least $$$a$$$ burles using his bank account);
- deposit $$$b$$$ burles to the account (he can make this operation only if he has $$$b$$$ burles in his possession).
Assume that Monocarp put all his $$$n$$$ burles in the bank account and he has no more money left, so he can work only with money he put in the bank.
Calculate the maximum possible amount of burles Monocarp can obtain from his bank account using only described operations.
InputThe first line contains three integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \le a, b \le n \le 10^{6}$$$) — the number of burles Monocarp deposited initially, the number of burles he can withdraw from the account in one operation, and the number of burles he can deposit to the account in one operation.
OutputPrint the maximum possible amount of burles Monocarp can obtain from his bank account using only operations described in the statement.
ExamplesInput17 5 3Output
17Input
97 10 6Output
96Input
77141 21540 3108Output
77136