#include <bits/stdc++.h>
using namespace std;
void winter_is_coming() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  winter_is_coming();
  long long q, l, r, ans, o, e;
  cin >> q;
  while (q--) {
    cin >> l >> r;
    ans = 0;
    e = r / 2;
    ans += (e * (e + 1));
    ans -= (r * (r + 1) / 2 - e * (e + 1));
    l--;
    e = l / 2;
    ans -= (e * (e + 1));
    ans += (l * (l + 1) / 2 - e * (e + 1));
    cout << ans << "\n";
  }
  return 0;
}
