You have been given an Unimodal function:
f(x)=2x2−12x+7
with N intervals. For each interval you will be given two integer values l and r , where l≤r and you need to find the minimum value of f(x) where x will be in the range [l,r] (both inclusive).
Input:
The first line will consists of one integer N denoting the number of intervals.
In next N lines, each line contains 2 space separated integers, l and r denoting the range of interval.
Output:
Print N lines, where ith line denotes the minimum value of f(x), where x will be in range [li,ri]
.
Constraints:
1≤N≤105
−106≤l≤r≤106
Here l=6 and r=8.
As f(6)=7, f(7)=21, f(8)=39. So the answer is 7.