#include <bits/stdc++.h>
using namespace std;
void file_i_o() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
vector<int> primeFactorization(int n) {
  vector<int> arr;
  for (int i = 1; i <= n; i++) {
    if (n % i == 0) arr.push_back(i);
  }
  return arr;
}
int main() {
  int n;
  scanf("%d", &n);
  long long l, r;
  while (n--) {
    cin >> l >> r;
    long long bsum = (l * (l - 1)) / 2;
    long long osum = (r * (r + 1)) / 2;
    osum -= bsum;
    l /= 2;
    long long ran = r / 2;
    if (r & 1) {
      ran++;
    }
    r = (ran * ran) - (l * l);
    osum -= r * 2;
    printf("%d \n", osum);
  }
  return 0;
}
