#include <bits/stdc++.h>
using namespace std;
long long p(long long a, long long b) {
  long long a0, an;
  if (a & 1LL) {
    if (a + 1LL <= b) a0 = a + 1LL;
  } else {
    a0 = a;
  }
  if (b & 1LL) {
    if (a <= b - 1LL) an = b - 1LL;
  } else {
    an = b;
  }
  if (a0 == an) return a0;
  long long n = (an - a0) / 2LL + 1LL;
  return (n * (an + a0)) / 2;
}
long long i(long long a, long long b) {
  long long a0, an;
  if (!(a & 1LL)) {
    if (a + 1LL <= b) a0 = a + 1LL;
  } else {
    a0 = a;
  }
  if (!(b & 1LL)) {
    if (a <= b - 1LL) an = b - 1LL;
  } else {
    an = b;
  }
  if (a0 == an) return a0;
  long long n = (an - a0) / 2LL + 1LL;
  return (n * (an + a0)) / 2;
}
int main() {
  int n, l, r;
  scanf("%d", &n);
  while (n--) {
    scanf("%d %d", &l, &r);
    if (l == r) {
      if (l & 1) {
        cout << -l << endl;
      } else {
        cout << l << endl;
      }
    } else {
      long long e = p(1LL * l, 1LL * r) - i(1LL * l, 1LL * r);
      cout << e << endl;
    }
  }
}
