#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(0);
  cout << fixed;
  int n;
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    int x, y;
    cin >> x >> y;
    int p = y - x + 1;
    if (x % 2 == 0) {
      if (p % 2 == 0)
        cout << (-(p / 2)) << endl;
      else
        cout << (-(p / 2) + y) << endl;
    } else {
      if ((p % 2) == 0)
        cout << (p / 2) << endl;
      else
        cout << ((p / 2) + (-y)) << endl;
    }
  }
  return 0;
}
