#include <bits/stdc++.h>
using namespace std;
long long q;
signed main() {
  cin >> q;
  for (long long i = 1; i <= q; i++) {
    long long x, y;
    cin >> x >> y;
    x--;
    long long semn1, semn2;
    if (x % 2) {
      x++;
      semn1 = 0;
    } else
      semn1 = 1;
    if (y % 2) {
      y++;
      semn2 = 0;
    } else
      semn2 = 1;
    x = -x / 2;
    y = -y / 2;
    if (semn1) x = abs(x);
    if (semn2) y = abs(y);
    cout << y - x << endl;
  }
}
