#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int n,t;
cin>>n;
for(int i=1;i<=n;i++)
{
int x=0,y=0,num=0;
cin>>x>>y;
if(y>x)
{
t=y;
y=x;
x=t;
}
if(x-y!=0)
{
for(int j=1;j<=x-y-1;j++)
{
int c=0;
c=y+j;
if(c%2==0)
continue;
else
num+=c;
}
cout<<num<<endl;
}
else
cout<<"0"<<endl;
}
return 0;
}