#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long l, r;
    cin >> l >> r;
    long long l1, r1;
    l1 = l * pow(-1, l);
    r1 = r * pow(-1, r);
    long long dif = r - l + 1;
    if (dif % 2 == 0) {
      if (l1 > 0) {
        cout << (-1) * (dif / 2) << endl;
      } else
        cout << dif / 2 << endl;
    } else {
      if (l1 > 0) {
        cout << (-1) * (dif / 2) + r1 << endl;
      } else
        cout << (dif / 2) + r1 << endl;
    }
  }
  return 0;
}
