In basic engineering subjects, we have the calculation of areas between curves. In this case, we will have to calculate the area between a parabola and the x-axis.
For example, consider the parabola $$$x^2-4$$$ over the range $$$[-3, 3]$$$:
In this case, the areas are: $$$$$$ A_1 = \Bigg | \int_{-3}^{-2} (x^2-4) \cdot dx \Bigg | = \frac{7}{3} $$$$$$ $$$$$$ A_2 = \Bigg | \int_{-2}^{2} (x^2-4) \cdot dx \Bigg | = \frac{32}{3} $$$$$$ $$$$$$ A_3 = \Bigg | \int_{2}^{3} (x^2-4) \cdot dx \Bigg | = \frac{7}{3} $$$$$$ Therefore, the requested area will be $$$A_1 + A_2 + A_3 = \displaystyle\frac{46}{3}$$$
Note that there are cases where the function may not intersect the x-axis in the range, such as $$$x^2+4\cdot x -5$$$ in the range $$$[-3,0]$$$
$$$$$$ A = \Bigg | \int_{-3}^{0} (x^2+4\cdot x- 5) \cdot dx \Bigg | = \frac{24}{1} $$$$$$
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5000$$$), indicating the number of test cases. This is followed by $$$t$$$ lines, one for each test case.
Each test case contains 5 integers $$$A, B, C, L, R$$$ $$$(-10^4 \leq A, B, C, L, R \leq 10^4)$$$ which are the coefficients of the equation $$$A\cdot x^2+B\cdot x+C = 0$$$ and the range $$$[L,R]$$$ where the function is evaluated. It is guaranteed that $$$L \leq R$$$ and that if there is an intersection with the x-axis, these intersections will occur at integer values. Also, $$$A \neq 0$$$.
For each test case, print a line with the requested area in the form $$$p/q$$$ where it is guaranteed that $$$p$$$ and $$$q$$$ are integers such that $$$GCD(p,q)=1$$$.
3 1 0 -4 -3 3 1 0 -4 0 3 1 4 -5 -3 0
46/3 23/3 24/1
| Name |
|---|


