#include <bits/stdc++.h>
int main() {
  long long n, i, t, tt, ans, num, koo;
  scanf("%I64d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%I64d %I64d", &t, &tt);
    ans = 0;
    num = tt - t + 1;
    koo = num / 2;
    if (t % 2 == 1)
      ans += koo;
    else
      ans -= koo;
    if (num % 2 == 1) {
      if (tt % 2 == 1)
        ans -= tt;
      else
        ans += tt;
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
