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