#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, a, b, f1, f2, n, res;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    if (a % 2 == 1 && b % 2 == 1) {
      n = (b - a) / 2 + 1;
      f1 = (n * (2 * a + (n - 1) * 2)) / 2;
      n = n - 1;
      f2 = (n * (2 * (a + 1) + (n - 1) * 2)) / 2;
      res = f2 - f1;
      cout << res << endl;
      continue;
    }
    if (a % 2 == 0 && b % 2 == 0) {
      n = (b - a) / 2;
      f1 = (n * (2 * (a + 1) + (n - 1) * 2)) / 2;
      n = n + 1;
      f2 = (n * (2 * a + (n - 1) * 2)) / 2;
      res = f2 - f1;
      cout << res << endl;
      continue;
    }
    if (a % 2 == 1 && b % 2 == 0) {
      n = (b - a + 1) / 2;
      f1 = (n * (2 * a + (n - 1) * 2)) / 2;
      f2 = (n * (2 * (a + 1) + (n - 1) * 2)) / 2;
      res = f2 - f1;
      cout << res << endl;
      continue;
    }
    if (a % 2 == 0 && b % 2 == 1) {
      n = (b - a + 1) / 2;
      f1 = (n * (2 * (a + 1) + (n - 1) * 2)) / 2;
      f2 = (n * (2 * a + (n - 1) * 2)) / 2;
      res = f2 - f1;
      cout << res << endl;
      continue;
    }
  }
  return 0;
}
