#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long q;
  cin >> q;
  while (q--) {
    long long a, b;
    cin >> a >> b;
    if (a == b) {
      if (a % 2 == 0) {
        cout << a << endl;
        continue;
      } else {
        cout << -1 * (a) << endl;
        continue;
      }
    } else if (a % 2 == 0 && b % 2 == 0) {
      long long n = b / 2 - a / 2 + 1;
      long long s1 = (n) * ((a + b) / 2);
      a = a + 1;
      b = b - 1;
      long long n1 = b / 2 - a / 2 + 1;
      long long s2 = (n1) * ((a + b) / 2);
      cout << s1 - s2 << endl;
    } else if (a % 2 != 0 && b % 2 != 0) {
      long long n = b / 2 - a / 2 + 1;
      long long s2 = (n) * ((a + b) / 2);
      a = a + 1;
      b = b - 1;
      long long n1 = b / 2 - a / 2 + 1;
      long long s1 = (n1) * ((a + b) / 2);
      cout << s1 - s2 << endl;
    } else if (a % 2 == 0 && b % 2 != 0) {
      long long y = b - 1;
      long long n = y / 2 - a / 2 + 1;
      long long s1 = (n) * ((a + y) / 2);
      long long x = a + 1;
      long long n1 = b / 2 - x / 2 + 1;
      long long s2 = (n1) * ((x + b) / 2);
      cout << s1 - s2 << endl;
    } else {
      long long x = a + 1;
      long long n = b / 2 - x / 2 + 1;
      long long s1 = (n) * ((x + b) / 2);
      long long y = b - 1;
      long long n1 = y / 2 - a / 2 + 1;
      long long s2 = (n1) * ((a + y) / 2);
      cout << s1 - s2 << endl;
    }
  }
}
