#include <bits/stdc++.h>
using namespace std;
long long int calc(long long int m) {
  long long int n = (m + 1) / 2;
  long long int res = n * (2 + (n - 1) * 2);
  res /= 2;
  res = -res;
  long long int n2 = m / 2;
  long long int res2 = (n2 * (4 + (n2 - 1) * 2));
  res2 /= 2;
  return res + res2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q;
  cin >> q;
  while (q--) {
    long long int l, r;
    cin >> l >> r;
    cout << calc(r) - calc(l - 1) << "\n";
  }
  return 0;
}
