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