In the Green Heart of Holland the villages are small and the roads are narrow. Some roads are only one car wide, so two cars that meet head on are stuck. A canal runs along both sides of the road, so neither driver can pull off the road to let the other one by. To get around this, the road is made a little wider here and there. At such a passing place one car stands aside while one or more cars from the other direction go past. That works while traffic is light. When many cars enter from both ends within a short time, the road jams.
Finding the best plan for such a road is quite hard, so this problem asks for something easier. The road runs east to west. An eastbound car enters at the west end and leaves at the east end, and a westbound car does the opposite. You are given the passing places, the number $e$ of eastbound cars, the number $w$ of westbound cars, and a schedule. For every pair of an eastbound car and a westbound car, the schedule names the point where those two cars pass each other.
Two cars that pass each other at point $z$ are both at $z$ at that moment, so neither of them travels past $z$ before the other one has arrived there.
Every car is ready to enter from the start and every driver wants to leave the road as early as possible. A car either stands still or drives at exactly 45 km/h, and starting and stopping take no time. Cars going the same way always keep a distance of at least 25 meters and never overtake each other, and they may queue up on the road while they wait. Two different passing places are at least 30 meters apart. The length of a car is ignored.
We measure the time between the moment the first car enters the road and the moment the last car leaves the road, and we want that interval to be as short as possible.
The first line contains the number $n$ of test cases. Each test case has the following form.
Westbound car $x$ enters the road before westbound car $x + 1$, and eastbound car $y$ enters the road before eastbound car $y + 1$. Numbers on one line are separated by one or more spaces.
For each test case print one line with one number: the time in seconds, rounded to the nearest integer, from the moment the first car enters the road until the moment the last car leaves it, for the fastest run that realizes the given schedule. Every distance is a whole number of meters and 45 km/h is 12.5 m/s, so the exact time is always a multiple of 0.08 seconds and never falls exactly halfway between two integers.