#include #include using namespace std; int main() { int T; int a, b, c, l, r; int i; int max, min; int temp; while(cin>>T) { while(T--) { cin>>a>>b>>c>>l>>r; max = -99999999; min = 99999999; for(i = l; i <= r; i++) { temp = a * i*i+ b* i+c; max = max >temp ? max:temp; min = min < temp?min:temp; } cout<