#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238463;
long long a, b, q;
int main(void) {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int size;
  cin >> size;
  while (size-- > 0) {
    cin >> a >> b;
    if (a == b) {
      if (a % 2 == 0)
        cout << a << "\n";
      else
        cout << (a * -1) << "\n";
    } else {
      if (a % 2 == 1) {
        if ((b - a + 1) % 2 == 0)
          cout << ((b - a + 1) / 2) << "\n";
        else
          cout << ((b - a + 1) / 2) - b << "\n";
      } else {
        if ((b - a + 1) % 2 == 0)
          cout << ((b - a + 1) / 2) * -1 << "\n";
        else
          cout << ((b - a + 1) / 2) * -1 + b << "\n";
      }
    }
  }
}
