#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    long long c = abs(a - b) + 1;
    if (c % 2 == 0) {
      if (b % 2 == 0)
        cout << c / 2 << endl;
      else
        cout << -c / 2 << endl;
    } else {
      long long d = (c - 1) / 2;
      if (b % 2 == 0)
        cout << b - d << endl;
      else
        cout << d - b << endl;
    }
  }
  return 0;
}
