#include <bits/stdc++.h>
using namespace std;
int i, z, y, n, x[10000][2];
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x[i][0] >> x[i][1];
    x[i][0]--;
  }
  for (i = 0; i < n; i++) {
    if (x[i][1] % 2 == 0)
      z = x[i][1] / 2;
    else
      z = (x[i][1] / 2 + 1) * -1;
    if (x[i][0] == 0)
      y = 0;
    else if (x[i][0] % 2 == 0)
      y = x[i][0] / 2;
    else
      y = (x[i][0] / 2 + 1) * -1;
    cout << z - y << endl;
  }
  return 0;
}
