시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 256 MB 17 6 5 38.462%

문제

\[\text{Let}~t = n/m;~~~z\left[ t \right] =\begin{cases} (a+(b+rt^{ 2 })z\left[ -1-2t \right] )/r & \text{ if }~ t\le 0 \\ (c+(d+rt^{ 2 })z\left[ 1-2t \right] )/r & \text{if}~t > 0 \end{cases}\]

Given integer \(a\), \(b\), \(c\), \(d\), \(n\), \(m\), and \(r\), evaluate \(z\left[ t \right]\) (as a floating point number).

\[1 \le n \le m \le 100 \\ 1 \le b \le r \\ 1 \le d \le r \\ 1 \le r \le 1000 \\ 1 \le a \le 1000 \\ 1 \le c \le 1000\]

There will be a solution. Your result must be accurate to within ±10−6 absolute error, or ±10−6 relative error.

입력

On the first line will be the number of functions to solve, between 1 and 100 inclusive. Following that will be one line per function, giving the integer parameters separated by spaces in the order \(n\), \(m\), \(a\), \(b\), \(c\), \(d\), \(r\).

출력

The value of the \(z \left[n/m \right]\) should be printed in floating point format, one line per parameter set.

예제 입력

3
1 1 1 1 1 1 1
2 3 1 2 3 4 10
2 3 5 6 7 8 9

예제 출력

-1
0.4225806452
4.111111111

힌트