410383: GYM104015 A Candies
Description
Monocarp works as a principal in a school. He has $$$n$$$ candies and he wants to gift some of them to his students. There are $$$a$$$ boys and $$$b$$$ girls in the school.
Monocarp has decided that he'll gift some positive number of candies to each boy (the same number of candies for each boy) and some positive number of candies to each girl (the same number of candies for each girl). Moreover, the number of candies he gifts to each boy should be strictly less than the number of candies he gifts to each girl.
Monocarp wants to gift as many of his $$$n$$$ candies as possible. Your task is to calculate the minimum possible number of candies that are not gifted to anyone, if you can decide how many candies each boy will receive and how many candies each girl will receive.
You may assume that the input data meets the following constraints: it is possible to give at least one candy to each boy and at least two candies to each girl (in other words, $$$a + 2 \cdot b \le n$$$).
InputThe first line contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$3 \le n \le 1\,000$$$, $$$1 \le a, b \le 100$$$, $$$a + b \cdot 2 \le n$$$) — the number of candies Monocarp has, the number of boys and the number of girls, respectively.
OutputPrint the minimum possible number of candies that are not gifted to anyone, if you can decide how many candies will receive each boy and how many candies will receive each girl.
ExamplesInput34 5 6Output
0Input
42 4 7Output
2Note
In the first example, Monocarp can give $$$2$$$ candies to every boy and $$$4$$$ candies to every girl, so he'll gift all his candies.
In the second example, Monocarp can give $$$3$$$ candies to every boy and $$$4$$$ candies to every girl. Then he'll gift $$$3 \cdot 4 + 4 \cdot 7 = 40$$$ candies in total, and $$$2$$$ candies will remain.