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