#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, n;
  cin >> t;
  n = t;
  while (t--) {
    long long int l, r;
    cin >> l >> r;
    if (l == r) {
      if (l % 2 == 0)
        cout << l << endl;
      else
        cout << -l << endl;
    } else if (l % 2 == 0 && r % 2 != 0) {
      if (l == 2)
        cout << (-1) * (r / 2) << endl;
      else
        cout << (-1) * (((r - l) / 2) + 1) << endl;
    } else if (l % 2 != 0 && r % 2 == 0) {
      if (l == 1)
        cout << r / 2 << endl;
      else
        cout << ((r - l) / 2) + 1 << endl;
    } else if (l % 2 != 0 && r % 2 != 0) {
      if (l == 1)
        cout << (r / 2) - r << endl;
      else
        cout << ((r - l) / 2) - r << endl;
    } else if (l % 2 == 0 && r % 2 == 0) {
      cout << l + ((r - l) / 2) << endl;
    }
  }
  return 0;
}
