#include <bits/stdc++.h>
struct ty {
  double v1;
  long long v2[2];
} ans, zero, tmp[5];
ty operator*(ty c1, ty c2) {
  c1.v1 *= c2.v1;
  c1.v2[1] = c1.v2[1] * c2.v2[0] + c1.v2[0] * c2.v2[1];
  c1.v2[0] *= c2.v2[0];
  c1.v2[1] += c1.v2[0] / 1000000000;
  c1.v2[0] %= 1000000000;
  c1.v2[1] %= 1000000000;
  return c1;
}
ty operator+(ty c1, ty c2) {
  c1.v1 += c2.v1;
  c1.v2[0] += c2.v2[0];
  c1.v2[1] += c2.v2[1];
  if (c1.v2[0] >= 1000000000) {
    c1.v2[0] -= 1000000000;
    ++c1.v2[1];
  }
  if (c1.v2[1] >= 1000000000) c1.v2[1] -= 1000000000;
  return c1;
}
ty operator-(ty c1, ty c2) {
  c1.v1 -= c2.v1;
  c1.v2[0] -= c2.v2[0];
  c1.v2[1] -= c2.v2[1];
  if (c1.v2[0] < 0) {
    c1.v2[0] += 1000000000;
    --c1.v2[1];
  }
  if (c1.v2[1] < 0) c1.v2[1] += 1000000000;
  return c1;
}
ty operator/(ty c1, int c2) {
  c1.v1 /= c2;
  c1.v2[0] = (c1.v2[1] % c2 * 1000000000 + c1.v2[0]) / c2;
  c1.v2[1] /= c2;
  return c1;
}
void eq(ty &c1, long long c2) {
  c1 = zero;
  c1.v1 = c2;
  c1.v2[0] = c2 % 1000000000;
  c1.v2[1] = c2 / 1000000000;
}
long long min(long long c1, long long c2) {
  if (c1 < c2) return c1;
  return c2;
}
void sum(long long beg, long long end, long long k) {
  if (end < beg) return;
  eq(tmp[0], beg);
  eq(tmp[1], end);
  tmp[2] = tmp[0] + tmp[1];
  tmp[3] = tmp[1] - tmp[0];
  tmp[3].v1 += 1.0;
  tmp[3].v2[0] += 1;
  if (tmp[3].v2[0] >= 1000000000) {
    tmp[3].v2[0] -= 1000000000;
    ++tmp[3].v2[1];
  }
  tmp[4] = tmp[2] * tmp[3];
  if (k > 0) {
    eq(tmp[0], k);
    ans = ans + tmp[4] / 2 * tmp[0];
  } else {
    eq(tmp[0], -k);
    ans = ans - tmp[4] / 2 * tmp[0];
  }
}
void done(long long x, long long y, int k) {
  if (x == 0 || y == 0) return;
  sum(1LL, min(x, y) * min(x, y), k);
  ty e[5];
  if (x > y) {
    eq(e[0], x);
    eq(e[1], x + 1);
    eq(e[2], 2 * x + 1);
    if (x & 1)
      e[1] = e[1] / 2;
    else
      e[0] = e[0] / 2;
    if (x % 3 == 0) e[0] = e[0] / 3;
    if (x % 3 == 1) e[2] = e[2] / 3;
    if (x % 3 == 2) e[1] = e[1] / 3;
    e[3] = e[0] * e[1] * e[2];
    eq(e[0], y);
    eq(e[1], y + 1);
    eq(e[2], 2 * y + 1);
    if (y & 1)
      e[1] = e[1] / 2;
    else
      e[0] = e[0] / 2;
    if (y % 3 == 0) e[0] = e[0] / 3;
    if (y % 3 == 1) e[2] = e[2] / 3;
    if (y % 3 == 2) e[1] = e[1] / 3;
    e[3] = e[3] - e[0] * e[1] * e[2];
    eq(e[0], y);
    if (k == 1)
      ans = ans + e[0] * e[3];
    else
      ans = ans - e[0] * e[3];
    sum(1LL, y - 1, (x - y) * (-k));
  }
  if (x < y) {
    --y;
    --x;
    eq(e[0], y);
    eq(e[1], y + 1);
    eq(e[2], 2 * y + 1);
    if (y & 1)
      e[1] = e[1] / 2;
    else
      e[0] = e[0] / 2;
    if (y % 3 == 0) e[0] = e[0] / 3;
    if (y % 3 == 1) e[2] = e[2] / 3;
    if (y % 3 == 2) e[1] = e[1] / 3;
    e[3] = e[0] * e[1] * e[2];
    eq(e[0], x);
    eq(e[1], x + 1);
    eq(e[2], 2 * x + 1);
    if (x & 1)
      e[1] = e[1] / 2;
    else
      e[0] = e[0] / 2;
    if (x % 3 == 0) e[0] = e[0] / 3;
    if (x % 3 == 1) e[2] = e[2] / 3;
    if (x % 3 == 2) e[1] = e[1] / 3;
    e[3] = e[3] - e[0] * e[1] * e[2];
    eq(e[0], y - x);
    e[3] = e[3] + e[0];
    ++y;
    ++x;
    eq(e[0], x);
    if (k == 1)
      ans = ans + e[0] * e[3];
    else
      ans = ans - e[0] * e[3];
    sum(1LL, x - 1, (y - x) * k);
  }
}
int main() {
  int t, a, b, c, d, m = 0;
  for (scanf("%d", &t); t; --t) {
    scanf("%d%d%d%d", &a, &b, &c, &d);
    ans = zero;
    done(c, d, 1);
    done(a - 1, b - 1, 1);
    done(a - 1, d, -1);
    done(c, b - 1, -1);
    if (ans.v1 < 1e10 && ans.v2[1] < 10)
      printf("%I64d\n", ans.v2[1] * 1000000000 + ans.v2[0]);
    else
      printf("...%010I64d\n",
             (ans.v2[1] % 10000 * 1000000000 + ans.v2[0]) % 10000000000ll);
  }
  return 0;
}
