#include <bits/stdc++.h>
using namespace std;
long long n, m, a, b, x, ff, l, r, cnt, ans;
vector<long long> v, f, res;
string s1, s2;
long long used[1001];
map<char, int> mp;
int main() {
  ios_base::sync_with_stdio(0);
  ;
  cin >> n;
  while (n) {
    cin >> l >> r;
    if (l % 2 == 0 && r % 2 == 0) {
      cout << (r + l) / 2 << endl;
    } else if (l % 2 != 0 && r % 2 != 0) {
      cout << (l + r) / 2 * -1 << endl;
      ;
    } else {
      if (l % 2 == 0) a = l / 2;
      if (l % 2 != 0) a = ((-(l + 1) / 2)) + 1;
      if (r % 2 == 0) b = r / 2;
      if (r % 2 != 0) b = (-(r + 1) / 2);
      cout << a + b << endl;
    }
    n--;
  }
}
