#include <bits/stdc++.h>
long long cacu(long long l, long long r) {
  return (r + l) / 2 * ((r - l) / 2 + 1);
}
int main() {
  int q, l, r;
  scanf("%d", &q);
  while (q--) {
    long long ans;
    scanf("%d%d", &l, &r);
    ans = cacu(l + (l & 1), r - (r & 1));
    ans -= cacu(l | 1, r - !(r & 1));
    printf("%lld\n", ans);
  }
  return 0;
}
