Cuber QQ has recently won a million dollars and bought a new car. He is now driving in the Infinite City and he doesn't want his car to stop, ever!
The Infinite City, looks like an infinite grid, with infinite streets built at all possible $x$'s and $y$'s when they are integers. The following picture, looks like part of this city. (The picture is downloaded from a webpage, which is certainly not describing the Infinite City.)
There are traffic lights installed on every crossings. Just like what Chinese people usually do, the traffic lights only show signals for left and straight and you can always turn right regardless of the traffic light. The estimate time of waiting for a left turn is $a$, at all crossings; and the time of waiting for a straight is $b$.
Cuber QQ is now driving from $(0, -1)$ to $(0, 0)$, about to entering the crossing at $(0, 0)$. At a crossing, he can choose to go straight, turn left or turn right. He wishes to go to $(x, y)$, but here is a weird request: he wants to have the least estimated traffic light waiting time. In other words, he doesn't care whether he has to drive a long way, or he has to burn a lot of gas, all he wants is to wait as little as possible.
Note that Cuber QQ doesn't have to wait for the traffic light at $(x, y)$; he also doesn't care from which direction he enters $(x, y)$.