#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long a, long long b) {
  while (b) {
    long long c = b;
    b = a % b;
    a = c;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
inline long long powmod(long long a, long long k) {
  long long b = 1;
  while (k) {
    if (k % 2 == 0) {
      k /= 2;
      a *= a;
    } else {
      k--;
      b *= a;
    }
  }
  return b;
}
int main() {
  int q;
  cin >> q;
  long long l, r;
  int i;
  bool left = false, right = false;
  for (i = 0; i < q; i++) {
    left = false, right = false;
    cin >> l >> r;
    if (l == r) {
      if (l % 2 == 0)
        cout << l << endl;
      else
        cout << -l << endl;
      continue;
    }
    if (l % 2 == 0) left = true;
    if (r % 2 == 0) right = true;
    if (left && right)
      cout << (-((r - 1) - l + 1) / 2) + r << endl;
    else if (left && !right)
      cout << -(r - l + 1) / 2 << endl;
    else if (!left && right)
      cout << (r - l + 1) / 2 << endl;
    else if (!left && !right)
      cout << (((r - 1) - l + 1) / 2) - r << endl;
  }
  return 0;
}
