#include <bits/stdc++.h>
using namespace std;
long long gcd(long long n, long long m) {
  if (n == 0) return m;
  return gcd(m % n, n);
}
bool ifprime(long long n) {
  if (n == 1) return false;
  long long i;
  for (i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
void disp(vector<long long> v) {
  for (auto u : v) cout << u << " ";
  cout << "\n";
}
void remleadzero(vector<int> &v) {
  vector<int> u;
  int i = 0;
  while (v[i] == 0) i++;
  while (i < v.size()) {
    u.push_back(v[i]);
    i++;
  }
  v = u;
}
long long fast_expo(long long n, long long m) {
  long long a = 1;
  while (m > 0) {
    if (m & 1) a = a * n;
    n = n * n;
    m /= 2;
  }
  return a;
}
int main() {
  long long q;
  cin >> q;
  while (q--) {
    long long l, r;
    cin >> l >> r;
    if (r - l < 4) {
      long long ans = 0;
      long long i = l;
      while (i <= r) {
        if (i & 1)
          ans -= i;
        else
          ans += i;
        i++;
      }
      cout << ans << "\n";
    } else {
      long long ans = 0;
      ans = ans + ((r - l + 1) * (r + l)) / 2;
      if ((r & 1) && (l & 1))
        ans = ans - (((r - l + 2) / 2) * (r + l));
      else if (r & 1)
        ans = ans - (((r - l + 1) / 2) * (r + l + 1));
      else if (l & 1)
        ans = ans - (((r - l + 1) / 2) * (r + l - 1));
      else
        ans = ans - (((r - l) / 2) * (r + l));
      cout << ans << "\n";
    }
  }
  return 0;
}
