You are doing construction work, and to save money you bought discounted irregular blocks. Each irregular block is rectangular except for one edge, which is curvy. You wedge the irregular blocks between stacks of ordinary blocks so they cannot slide sideways or rotate. The lower irregular block sits with its curvy edge pointing up, and the one above it sits with its curvy edge pointing down. The upper block is lowered straight down until it just touches the lower one.
You want to know how well the two blocks fit together. At the moment the upper block just touches the lower one, the fit quality is the largest vertical gap between the upper edge of the bottom block and the lower edge of the top block.
Every block is one unit wide. Both curvy edges are cubic polynomials in x, with the left edge of a block at x=0 and the right edge at x=1.
The input holds several test cases and ends at end of file. There are at most 500 test cases.
Each test case is two lines, and each line holds four real numbers.
The first line gives b0 b1 b2 b3. The upper edge of the bottom block has the shape of b0+b1x+b2x2+b3x3 for 0≤x≤1.
The second line gives t0 t1 t2 t3. The lower edge of the top block has the shape of t0+t1x+t2x2+t3x3 for 0≤x≤1.
No input value has magnitude greater than 50000.
For each test case, print the fit quality on its own line.
Round the value to six digits after the decimal point and always print all six digits, even when they are zero. A value of 3 prints as 3.000000.
No test case has an answer sitting on a boundary where the sixth digit could round either way.