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

Задача 38267. Smile!


Задача

Темы:
The holidays began, and Uncle Fyodor, having pretty much missed his school friends, invited them all to visit him in Prostokvashino. After some thought, n of them agreed to come. Taking with them all the things necessary for outdoor recreation, they arrived at the station to buy tickets. It turned out that in the trains going to Prostokvashino, there are only compartment cars. Each car has k4 four-seater compartments and k2 — new double compartments. Except for Uncle Fyodor's friends, no one wants to go to Prostokvashino, so all the seats on the train are still free. The friends decided that they wanted to go all in the same car: it's more fun together. To make the trip memorable for a long time, one of Uncle Fyodor's friends, Zhenya, decided to borrow a Zenit camera from his father. and take pictures of all the participants of the trip, each sitting in his place on the train, one picture per compartment. But the film is expensive, and developing — this is long and tedious, so Zhenya asked to buy tickets so that the whole friendly company occupies as little compartment as possible. Help Zhenya calculate how many frames he will need at best to photograph the whole company, that is, calculate the minimum number of compartments they should occupy.

Input
The first and only line contains the numbers n, k4 and k2 — the number of Uncle Fyodor's friends traveling to Prostokvashino, the number of four-seat compartments in the car and the number of two-seat compartments in the car, respectively (1≤n≤1018, 0≤k4≤10 18, 0≤k2≤1018).

Imprint
Print a single integer — the minimum number of compartments that can accommodate all of Uncle Fyodor's friends. If you can't fit all your friends in one car, print −1.
Examples
# Input Output
1 10 5 3 3