#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double pi = acos(-1);
const int maxn = 1e5 + 10, maxm = 1e6 + 5, maxc = 26;
const char bs = 'a';
const long long mod = 1e9 + 7;
inline long long qpow(long long a, int n, long long MOD) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = ans * a % MOD;
    a = a * a % MOD, n >>= 1;
  }
  return ans;
}
int main() {
  int q, l, r;
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d", &l, &r);
    if (l == r)
      printf("%d\n", (l & 1) ? -l : l);
    else if ((r - l) & 1)
      printf("%d\n", (l & 1) ? (r - l + 1) / 2 : -(r - l + 1) / 2);
    else
      printf("%d\n", (l & 1) ? (r - l) / 2 - r : -(r - l) / 2 + r);
  }
  return 0;
}
