#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, n, m;
  cin >> q;
  while (q--) {
    cin >> n >> m;
    int temp, ans;
    if (n == m && n % 2 == 0) {
      cout << n << endl;
      continue;
    } else if (n == m && n % 2) {
      cout << "-" << n << endl;
      continue;
    }
    if (n > m) {
      temp = n;
      n = m;
      m = temp;
    }
    if (m % 2 == 0) {
      if (n % 2) {
        ans = (m - n + 1) / 2;
      } else
        ans = (m - n) / 2 + n;
    } else {
      if (n % 2) {
        ans = (m - n) / 2 - m;
      } else
        ans = -(m - n + 1) / 2;
    }
    cout << ans << endl;
  }
  return 0;
}
