Time Limit: 2000/1000 MS (Java/Others)

Memory Limit: 131072/131072 K (Java/Others)

After attending the class given by Jin Longyu, who is a specially-graded teacher of Mathematics, GTW started to solve problems in a book titled “From Independent Recruitment to Olympiad”. Nevertheless, there are too many problems in the book yet GTW had a sheer number of things to do, such as dawdling away his time with his young girl. Thus, he asked you to solve these problems.

In each problem, you will be given a function whose form is like $f(x)=ax ^ 2 + bx + c$. Your assignment is to find the maximum value and the minimum value in the integer domain $[l, r]$.

In each problem, you will be given a function whose form is like $f(x)=ax ^ 2 + bx + c$. Your assignment is to find the maximum value and the minimum value in the integer domain $[l, r]$.

The first line of the input file is an integer $T$, indicating the number of test cases. ($T\leq 1000$)

In the following $T$ lines, each line indicates a test case, containing 5 integers, $a, b, c, l, r$. ($|a|, |b|, |c|\leq 100, |l|\leq |r|\leq 100$), whose meanings are given above.

In the following $T$ lines, each line indicates a test case, containing 5 integers, $a, b, c, l, r$. ($|a|, |b|, |c|\leq 100, |l|\leq |r|\leq 100$), whose meanings are given above.

提交代码