#include <bits/stdc++.h>
using namespace std;
long long n, s, s1, m, k, sum = 0, l, r, a, a1, p;
const int N = 1e5 + 1;
int main() {
  int q;
  cin >> q;
  while (q--) {
    cin >> l >> r;
    if (l % 2) {
      if (r % 2) {
        p = (r / 2) - (l / 2) + 1;
        s = (l + r) * p;
        s /= 2;
        a = l + 1;
        a1 = r - 1;
        p--;
        s1 = (a + a1) * p;
        s1 /= 2;
        sum = s1 - s;
        cout << sum << endl;
      } else {
        a1 = r - 1;
        p = (r / 2) - (l / 2);
        s = (l + a1) * p;
        s /= 2;
        a = l + 1;
        s1 = (a + r) * p;
        s1 /= 2;
        sum = s1 - s;
        cout << sum << endl;
      }
    } else {
      if (r % 2) {
        a = l + 1;
        a1 = r;
        p = (r / 2) + 1;
        p = p - (l / 2);
        s = (a + a1) * p;
        s /= 2;
        a1 = r - 1;
        s1 = (l + a1) * p;
        s1 /= 2;
        sum = s1 - s;
        cout << sum << endl;
      } else {
        p = (r / 2) - (l / 2) + 1;
        s1 = (l + r) * p;
        s1 /= 2;
        p--;
        l++;
        r--;
        s = (l + r) * p;
        s /= 2;
        sum = s1 - s;
        cout << sum << endl;
      }
    }
  }
  return 0;
}
