#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int x,y,j,f,z[10001] = { 0 },i;
for(i = 0; i < n; i++)
{
scanf("%d%d",&x,&y);
if (x > y)
{
f = x;
x = y;
y = f;
}
for (j = x + 1; j < y; j++)
{
if(j % 2 != 0)
z[i] += j;
}
}
for(i = 0; i < n; i++)
printf("%d\n",z[i]);
return 0;
}