#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9 + 7;
const long long MOD = (long long)1e9 + 7;
const double eps = 1e-7;
const int N = (int)1e3;
int q;
long long l, r;
long long sum_0(long long r) {
  r >>= 1;
  return r * (r + 1);
}
long long sum_1(long long r) {
  r -= 1;
  r >>= 1;
  return r * (r + 2);
}
signed main() {
  scanf("%d", &q);
  for (int i = 0; i < q; ++i) {
    scanf("%lld%lld", &l, &r);
    printf("%lld\n", sum_0(r) + sum_1(l - 1) - sum_0(l - 1) - sum_1(r));
  }
  return 0;
}
