#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000;
int n, k;
map<int, int> mp;
int jj(int k) {
  if (k % 2 == 0)
    return k / 2;
  else
    return -(k + 1) / 2;
}
int main() {
  int a, b, n;
  long long sum = 0;
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%d%d", &a, &b);
      cout << jj(b) - jj(a - 1) << endl;
    }
  }
}
