Given sequences of k
1, k
2, … k
n, a
1, a
2, …, a
n and b
1, b
2, …, b
n. Consider following function:
Then we draw F(x) on a xy-plane, the value of x is in the range of [0,100]. Of course, we can get a curve from that plane.
Can you calculate the length of this curve?
The first line of the input contains one integer T (1<=T<=15), representing the number of test cases.
Then T blocks follow, which describe different test cases.
The first line of a block contains an integer n ( 1 <= n <= 50 ).
Then followed by n lines, each line contains three integers ki, ai, bi ( 0<=ai, bi<100, 0<ki<100 ) .
For each test case, output a real number L which is rounded to 2 digits after the decimal point, means the length of the curve.
2
3
1 2 3
4 5 6
7 8 9
1
4 5 6