#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q, l, r, beg, en, odd, even;
  cin >> q;
  while (q--) {
    cin >> l >> r;
    beg = l;
    en = r;
    if (l % 2 == 0) beg++;
    if (r % 2 == 0) en--;
    if (beg <= en)
      odd = ((beg + en) * ((en - beg) / 2 + 1)) / 2;
    else if (l % 2)
      odd = l;
    else
      odd = 0;
    beg = l;
    en = r;
    if (l % 2) beg++;
    if (r % 2) en--;
    if (beg <= en)
      even = ((beg + en) * ((en - beg) / 2 + 1)) / 2;
    else if (l % 2 == 0)
      even = l;
    else
      even = 0;
    cout << even - odd << '\n';
  }
  return 0;
}
