#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chkmax(T &x, T y) {
  x = x > y ? x : y;
}
template <typename T>
void chkmin(T &x, T y) {
  x = x > y ? y : x;
}
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  x *= f;
}
int main() {
  int q;
  read(q);
  while (q--) {
    int l, r;
    read(l), read(r);
    if (l == r) {
      cout << ((l % 2 == 0) ? l : -l) << "\n";
      continue;
    }
    int a, b, c, d;
    if (l % 2 == 0)
      a = l, c = l + 1;
    else
      a = l + 1, c = l;
    if (r % 2 == 0)
      b = r, d = r - 1;
    else
      b = r - 1, d = r;
    long long s1 = 1ll * (a + b) * ((b - a) / 2 + 1) / 2,
              s2 = 1ll * (c + d) * ((d - c) / 2 + 1) / 2;
    cout << s1 - s2 << "\n";
  }
  return 0;
}
