#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
int n, x, y, sum=0;
cin >> n;
for (int i = 0; i < n; i ++ )
{
cin >> x >> y ;
if(x>y) swap(x,y); //判断是否小位数在前面
if(x%2==0) x=x-1; //如果是偶数就减去一位
while(x+2<y)
{
x=x+2;
sum+=x ;
}
cout << sum <<endl;
sum=0; //注意如果每进行完一次运算,需要变为零重新运算
}
}