#include <bits/stdc++.h>
using namespace std;
long long sum(int r) {
  long long res = (r / 2);
  return (r & 1) ? (res - r) : res;
}
long long sum(int l, int r) { return sum(r) - sum(l - 1); }
int main(int argc, char const *argv[]) {
  int q, l, r;
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d", &l, &r);
    printf("%I64d\n", sum(l, r));
  }
}
