Олимпиадный тренинг

Задача 42937. Present


Задача

Темы:
You need to put exactly N candies into the New Year's sweet present. Candies are stored in the warehouse, collected in one piece and three pieces in one package. In total there are A packages of one candy and B packages of three candies. Determine the maximum number of gifts you can collect from the available candies, if packages of three candies cannot be opened and divided into separate candies.

Input
The first line of the input contains a positive integer N — the number of sweets in one gift. The second line of the input contains a non-negative integer A — the number of packages of one candy. The third line contains a non-negative integer B — number of packages of three sweets.
The number N and the total number of sweets in stock do not exceed 2 x; 109.

Imprint
The program should output a single integer — the maximum number of gifts that can be collected from the available candies
Examples
# Input Output
1 4
8
2
3


Remark
In the example from the condition, there are 8 packages of one candy and 2 packages of three candies in the warehouse. In one gift you need to put 4 candies. Two gifts can be collected using 1 pack of one candy and 1 pack of three candies. Another gift can be assembled from 4 packages of one candy. In total, 6 packages of one candy and 2 packages of three candies were used, there are 2 packages of one candy left, which will not be enough for an additional gift.