For a positive integer n and parameters a, b, c, p, q, define on x > 0 the function
f_n(x) = a * exp(-x) * cos(b*x) * cos(x/n) + c * n^p * x^q * exp(-n*x)
Let I_n be the integral of f_n(x) over (0, infinity). For every query, I_n is finite for each n. Compute
L = limit of I_n as n -> infinity
or determine that the limit is not finite.
The first line contains the integer T, the number of queries. Each of the next T lines contains a, b, c (real numbers with at most 6 digits after the decimal point) and p, q (integers), separated by spaces.
T lines. On line i, print L for query i with absolute or relative error at most 1e-9, or the string DIVERGES if the limit is not finite.
1 <= T <= 10000
|a|, |c| <= 10
|b| <= 5
0 <= p <= 10
0 <= q <= 8
Input:
4
2.5 0 0 3 2
0 1 3 1 0
1 2 4 2 2
1 1 -2 4 1
Output:
2.5
3.0
0.2
DIVERGES
This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.
4 2.5 0 0 3 2 0 1 3 1 0 1 2 4 2 2 1 1 -2 4 1
2.5 3.0 0.2 DIVERGES
8 -0.73257 1.074551 0 9 0 -7.028942 4.033566 -9.438613 6 5 5.0183 2.931457 5.244537 4 7 8.346588 -1.686972 9.493452 9 7 7.667559 -3.200734 0 3 1 -3.437822 1.310219 0.000049 6 5 5.963803 4.999742 0.610095 4 3 3.641101 0.22503 0 5 3
-0.3399933402275402 -1133.0405711494252 0.5230970251834705 DIVERGES 0.6818821550729738 -1.2595726151121562 3.8899698013929935 3.4656078155149963