#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    long long int x, y;
    cin >> x >> y;
    long long int sum = 0;
    if (y == x && y % 2 == 0) {
      cout << y << "\n";
      continue;
    }
    if (y == x && y % 2 == 1) {
      cout << -y << "\n";
      continue;
    }
    long long int n = (y - x + 1) / 2;
    if (x % 2 == 0 && y % 2 == 0)
      sum = n + x;
    else if ((x % 2 == 1 && y % 2 == 1)) {
      sum = -n - x;
    } else if ((x % 2 == 1 && y % 2 == 0)) {
      sum = n;
    } else if ((x % 2 == 0 && y % 2 == 1)) {
      sum = -(n);
    }
    cout << sum << "\n";
  }
  return 0;
}
