#include <bits/stdc++.h>
using namespace std;
const long long N = 1e9 + 5;
bool col2(pair<long long, long long> p1, pair<long long, long long> p2) {
  return p1.second > p2.second;
}
struct comp {
  bool operator()(long long const &x, long long const &y) { return x > y; }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long l, r;
    cin >> l >> r;
    long long ans = 0;
    long long r1, r2;
    r1 = r2 = r;
    long long l1, l2;
    l1 = l2 = l;
    if (l % 2 == 0)
      l2 = l + 1;
    else
      l1 = l + 1;
    if (r % 2 == 0)
      r2 = r - 1;
    else
      r1 = r - 1;
    long long sum, sum1;
    sum = sum1 = 0;
    long long n = r1 - l1 + 1;
    long long n1 = r2 - l2 + 1;
    n = (n + 1) / 2;
    n1 = (n1 + 1) / 2;
    sum = ((n) * (2 * l1 + (n - 1) * 2)) / 2;
    sum1 = ((n1) * (2 * l2 + (n1 - 1) * 2)) / 2;
    cout << sum - sum1 << endl;
  }
}
