#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    int plus = 0;
    if (l % 2 == 0) {
      plus = -1;
    } else {
      plus = 1;
    }
    long long res = plus * (r - l + 1) / 2;
    if ((r - l + 1) % 2 != 0) {
      int k = r;
      if (r % 2 != 0) k *= -1;
      res += k;
    }
    cout << res << endl;
  }
  return 0;
}
