Question
Flower Arrangement Pattern
Ethan is organizing a line of containers with two types of flowers: roses and lilies, following a set pattern. He starts with an empty line and places R roses in the first few containers, then L lilies in the next few, repeating this sequence until all containers are filled. Given that the line has a total of N containers, can you help Ethan determine how many will contain roses?
Input
The first line contains three space-separated integers N, A, and B.
Constraints
1 ≤ N ≤ 1018
A, B ≥ 0
0 < A + B ≤ 1018
Constraints
1 ≤ N ≤ 1018
A, B ≥ 0
0 < A + B ≤ 1018
Output
Print the number of apples that will be there among the first N fruits.
Example
Sample Input
8 3 4
Sample Output
4
Explanation
Let b denote bananas, and r denote apples. The first eight fruits in the row will be bbbrrrrb, among which there are four apples.
8 3 4
Sample Output
4
Explanation
Let b denote bananas, and r denote apples. The first eight fruits in the row will be bbbrrrrb, among which there are four apples.