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