BRI  Bridge
Find a place to build a bridge over the river, so as to minimize total cost of the route between two cities A and B, located on opposite sides of the river.
Input
There is a single positive integer T on the first line of input (equal to about 100000). It stands for the number of test cases to follow. Each test case is exactly one line, containing six integers a, b, c, h, s1 and s2 (0 < a, b, c, h, s1, s2 < 100), separated by spaces. a  the distance from city A to the river (the length of segment AE in the figure), b  the distance from city B to the river (the length of segment FG in the figure), c  the distance between A and B along the axis parallel to the river (the length of segment BF in the figure) and h  the width of the river (EG in the figure). s1 and s2 are the costs of unit of road and bridge respectively.
Output
For each test case your program should write a single number to the standard output, equal to the minimal total cost of the route between A and B, accurate up to two digits after the decimal dot.
Example
Input:
1
1 1 1 1 1 1
Output:
3.16
hide comments
(Tjandra Satria Gunawan)(æ›¾æ¯…æ˜†):
20120911 16:06:05
@mini:


mini:
20120911 15:29:21
could someone with AC please post solution for


well i am lagging:
20120402 11:25:15
position of C,D which we have to find is an integer right? 

ruchin:
20100511 09:50:39
@Chinmay:well i think taking this as refraction of light will solve it..and on my pc the results are perfectly fine..but here i m getting TLE...dont know how to solve the equation for sine of theta....so actually i m increasing the value of theta by 0.001 until the theta doesn't satisfy the equation...i know it's bad algo but i dont have any other choice...if u find anything else on this then please tell me..i m stuck on this... Last edit: 20100511 09:55:35 

Reborn In Fire...:
20100424 20:09:00
can ne1 suggest some page or give a hint?? 

[Trichromatic] XilinX:
20091110 07:52:49
1e9 is enough :) 

Tony Beta Lambda:
20091110 04:59:36
Epsilon is quite small. 1e12 is okay. 
Added by:  Ruslan Sennov 
Date:  20090927 
Time limit:  1.237s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL NODEJS PERL6 VB.NET 
Resource:  Based on HSPL09BRI 