#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
while(n--)
{
int x, y;
cin >> x >> y;
int ans = 0;
if(x > y) swap(x, y);
for(int i = x + 1; i < y; i++)
{
if(i % 2 != 0) ans += i;
}
cout << ans << endl;
}
return 0;
}