#P1249. Special Week With Dance Power

Special Week With Dance Power

题目描述

In the recent dance class, Teio has taught Special Week one formula to calculate the dance power D(x)D(x):

$$d(x)=\int_0^x \frac{dt}{t^2+(a+b)t+ab}+\frac{lnb-lna}{a-b}$$

$$D(x)=\sum \limits_{i=1}^x ad(x)-bd(x)$$

As poor as Special Week's math is, for three given positive integer a,b,xa,b,x please help her calculate D(x)D(x)

输入格式

The first line contains one positive integer T(1leTle105)T(1\\le T\\le10^5) indicating the number of the queries.

Then followed TT lines, each line contains three positive integers a,b,x(1lea,b,xle109)a,b,x (1\\le a,b,x\\le10^9).

输出格式

For each query, output one number, the answer D(x)D(x).

Your answer will be considered correct, if its absolute or relative error isn't greater than 10610^{-6}. Formally, let your answer be aa, while jury's answer be bb. Your answer will be considered correct if fracabmax(a,b)le106\\frac{|a-b|}{max(a,b)}\\le10^{-6}holds.

样例

3 
1 2 3 
9 8 7 
2021 4 9
0.6694306539 
-0.4517696480 
-45.4575754312