#include <iostream>
using namespace std;
int main(){
int n; cin >> n;
while(n -- ){
int l, r; cin >> l >> r;
int maxv = max(l, r);
l += r, r = maxv, l -= r;
int sum = 0;
for(int i = l + 1; i < r; i ++ ){
if(i % 2) sum += i;
}
cout << sum << endl;
}
return 0;
}