#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 123;
const long double EPS = 1e-9;
const int MX = 1e9 + 1;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 5e5 + 123;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
long long a[N], b[N];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] % 2 == 0) {
      if (b[i] % 2 == 0) {
        cout << (-1) * ((b[i] - a[i] + 1) / 2) + b[i] << endl;
      } else {
        cout << (-1) * ((b[i] - a[i] + 1) / 2) << endl;
      }
    } else {
      if (b[i] % 2 == 0) {
        cout << ((b[i] - a[i] + 1) / 2) << endl;
      } else {
        cout << ((b[i] - a[i] + 1) / 2) - b[i] << endl;
      }
    }
  }
  return 0;
}
