#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    long long int l, r, sum1, sum2, x1, y1, x2, y2;
    cin >> l >> r;
    x1 = r / 2;
    x1 = x1 * (x1 + 1);
    x2 = (l - 1) / 2;
    x2 = x2 * (x2 + 1);
    sum1 = x1 - x2;
    r = ceil(r / 2.0);
    y1 = pow(r, 2);
    l = ceil((l - 1) / 2.0);
    y2 = pow(l, 2);
    sum2 = (y1 - y2) * -1;
    cout << sum1 + sum2 << endl;
  }
  return 0;
}
