#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void chkmin(T &x, T y) {
  x = min(x, y);
}
template <typename T>
inline void chkmax(T &x, T y) {
  x = max(x, y);
}
template <typename T>
inline void read(T &x) {
  T f = 1;
  x = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
  x *= f;
}
int main() {
  int q;
  read(q);
  while (q--) {
    long long l, r;
    read(l);
    read(r);
    long long ans = (l + r) * (r - l + 1) / 2;
    if (!(r & 1)) --r;
    if (!(l & 1)) ++l;
    if (l > r)
      cout << ans << '\n';
    else
      cout << ans - (l + r) * ((r - l) / 2 + 1) << '\n';
  }
  return 0;
}
