Warith barely plays Clash Royale, so not only can he not come up with good flavortext, but he's completely terrible at the game. It's gotten to the point where he uses a Mega Knight deck to help him win all his games...
Anyway, Warith wants to figure out how fast Mega Knight can move in order to optimize his deck. He figures out that Mega Knight can walk at a pace of $$$a$$$ units per second. He's also able to charge up and leap a distance of $$$b$$$ units, but this takes him $$$3$$$ seconds due to the charging and travel distance. Given a distance $$$n$$$ to travel, where the card starts at $$$x = 0$$$ at $$$t = 0$$$, can you find how long it takes Mega Knight to travel if he moves optimally? Note that if Mega Knight ever oversteps he will be under fire, so he must travel exactly $$$n$$$ meters.
The input consists of a single line of three integers: the walking pace $$$a$$$, the leaping distance $$$b$$$, and the total distance to travel $$$n$$$. The following constraints are given:
Output a single integer $$$t$$$, the minimum time in seconds it takes for Mega Knight to travel $$$n$$$ units. If it is impossible for him to travel exactly $$$n$$$ meters, print $$$-1$$$.
1 2 10
10
2 4 11
-1
In the first case, it is optimal to just walk $$$10 \cdot 1$$$ units in $$$10$$$ seconds, rather than use a leap at all.
In the second case, it is impossible to travel $$$11$$$ units with a walking pace of $$$2$$$ and a leap of $$$4$$$.