#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653589793;
void dfs(bool vis[], long long s, vector<long long> v[],
         vector<long long> &ans1) {
  for (long long i = 0; i < v[s].size(); i++) {
    if (vis[v[s][i]] == 0) {
      ans1.push_back(v[s][i]);
      vis[v[s][i]] = 1;
      dfs(vis, v[s][i], v, ans1);
    }
  }
}
bool isprime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
void bfs(vector<long long> v[], long long s, long long n) {
  priority_queue<long long, vector<long long>, greater<long long> > q;
  q.push(s);
  bool vis[n + 1];
  memset(vis, 0, sizeof(vis));
  vis[s] = 1;
  vector<long long> ans;
  while (q.empty() == false) {
    long long temp = q.top();
    q.pop();
    ans.push_back(temp);
    for (long long i = 0; i < v[temp].size(); i++) {
      if (vis[v[temp][i]] == false) {
        vis[v[temp][i]] = true;
        q.push(v[temp][i]);
      }
    }
  }
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
}
vector<long long> fact(long long n) {
  vector<long long> v;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      v.push_back(i);
      if (i != n / i) {
        v.push_back(n / i);
      }
    }
  }
  return v;
}
struct comp {
  bool func() {}
};
bool issquare(long long n) {
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0 && i == n / i) {
      return true;
    }
  }
  return false;
}
long long facto(long long n) {
  long long ans = 1;
  for (long long i = 2; i <= n; i++) {
    ans *= i;
  }
  return ans;
}
void frooty() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == b) {
      if (a % 2 == 0)
        cout << a << "\n";
      else
        cout << -a << "\n";
    } else {
      if (a % 2 == 1 && b % 2 == 0) {
        cout << (b - a + 1) / 2 << "\n";
      } else if (a % 2 == 0 && b % 2 == 1) {
        cout << -(b - a + 1) / 2 << "\n";
      } else if (a % 2 == 0 && b % 2 == 0) {
        cout << a + (b - a + 1) / 2 << "\n";
      } else {
        cout << -a - (b - a + 1) / 2 << "\n";
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    frooty();
  }
}
