#include <bits/stdc++.h>
using namespace std;
struct Gao {
  long long int ww[7];
  Gao() { memset(ww, 0, sizeof(ww)); }
  friend Gao operator+(const Gao &, const Gao &);
  friend Gao operator+(const Gao &, const long long int &);
  friend Gao operator+(const long long int &, const Gao &);
  friend Gao operator-(const Gao &, const Gao &);
  friend Gao operator-(const Gao &, const long long int &);
  friend Gao operator-(const long long int &, const Gao &);
  friend Gao operator*(const Gao &, const Gao &);
  friend Gao operator*(const Gao &, const long long int &);
  friend Gao operator*(const long long int &, const Gao &);
};
Gao operator+(const Gao &a, const Gao &b) {
  int i;
  Gao ret = a;
  long long int c = 0;
  for (i = 0; i < 7; i++) {
    ret.ww[i] += b.ww[i] + c;
    if (ret.ww[i] >= 10000000ll) {
      ret.ww[i] -= 10000000ll;
      c = 1;
    } else
      c = 0;
  }
  return ret;
}
Gao operator+(const Gao &a, const long long int &b) {
  int i;
  Gao ret = a;
  long long int c = b, d;
  for (i = 0; i < 7 && c != 0; i++) {
    ret.ww[i] += c;
    d = (ret.ww[i] % 10000000ll + 10000000ll) % 10000000ll;
    c = (ret.ww[i] - d) / 10000000ll;
    ret.ww[i] = d;
  }
  return ret;
}
Gao operator+(const long long int &b, const Gao &a) {
  int i;
  Gao ret = a;
  long long int c = b, d;
  for (i = 0; i < 7 && c != 0; i++) {
    ret.ww[i] += c;
    d = (ret.ww[i] % 10000000ll + 10000000ll) % 10000000ll;
    c = (ret.ww[i] - d) / 10000000ll;
    ret.ww[i] = d;
  }
  return ret;
}
Gao operator-(const Gao &a, const Gao &b) {
  int i;
  Gao ret = a;
  long long int c = 0;
  for (i = 0; i < 7; i++) {
    ret.ww[i] -= b.ww[i] + c;
    if (ret.ww[i] < 0) {
      ret.ww[i] += 10000000ll;
      c = 1;
    } else
      c = 0;
  }
  return ret;
}
Gao operator-(const Gao &a, const long long int &b) {
  int i;
  Gao ret = a;
  long long int c = b, d;
  for (i = 0; i < 7 && c != 0; i++) {
    ret.ww[i] -= c;
    d = (ret.ww[i] % 10000000ll + 10000000ll) % 10000000ll;
    c = (ret.ww[i] - d) / 10000000ll;
    ret.ww[i] = d;
  }
  return ret;
}
Gao operator-(const long long int &b, const Gao &a) {
  int i;
  Gao ret = Gao();
  long long int c = 0, d;
  for (c = 0; c < 7 && a.ww[c] == 0; c++)
    ;
  if (c < 7) ret.ww[c] = 10000000ll - a.ww[c];
  for (c++; c < 7; c++) ret.ww[c] = 10000000ll - 1 - a.ww[c];
  c = b;
  for (i = 0; i < 7 && c != 0; i++) {
    ret.ww[i] += c;
    d = (ret.ww[i] % 10000000ll + 10000000ll) % 10000000ll;
    c = (ret.ww[i] - d) / 10000000ll;
    ret.ww[i] = d;
  }
  return ret;
}
Gao operator*(const Gao &a, const Gao &b) {
  int i, j;
  Gao ret = Gao();
  long long int c = 0;
  for (i = 0; i < 7; i++) {
    ret.ww[i] = a.ww[i] * b.ww[0];
    for (j = 1; j + i < 7; j++) ret.ww[i + j] = a.ww[i] * b.ww[j];
  }
  for (i = 0; i < 7; i++) {
    ret.ww[i] += c;
    c = ret.ww[i] / 10000000ll;
    ret.ww[i] %= 10000000ll;
  }
  return ret;
}
Gao operator*(const Gao &a, const long long int &b) {
  int i;
  Gao ret = Gao();
  long long int c = 0, d;
  for (i = 0; i < 7; i++) {
    ret.ww[i] = a.ww[i] * b + c;
    d = (ret.ww[i] % 10000000ll + 10000000ll) % 10000000ll;
    c = (ret.ww[i] - d) / 10000000ll;
    ret.ww[i] = d;
  }
  return ret;
}
Gao operator*(const long long int &b, const Gao &a) {
  int i;
  Gao ret = Gao();
  long long int c = 0, d;
  for (i = 0; i < 7; i++) {
    ret.ww[i] = a.ww[i] * b + c;
    d = (ret.ww[i] % 10000000ll + 10000000ll) % 10000000ll;
    c = (ret.ww[i] - d) / 10000000ll;
    ret.ww[i] = d;
  }
  return ret;
}
Gao C2(long long int a) {
  if (a < 2) return Gao();
  long long int a1 = a - 1;
  if ((a & 1) == 0)
    a >>= 1;
  else
    a1 >>= 1;
  Gao g = Gao();
  g.ww[0] = a % 10000000ll;
  g.ww[1] = a / 10000000ll;
  g = g * a1;
  return g;
}
Gao C3(long long int a) {
  if (a < 3) return Gao();
  long long int a1 = a - 1, a2 = a - 2;
  if ((a & 1) == 0)
    a >>= 1;
  else
    a1 >>= 1;
  if (a % 3 == 0)
    a /= 3;
  else if (a1 % 3 == 0)
    a1 /= 3;
  else
    a2 /= 3;
  Gao g = Gao();
  g.ww[0] = a % 10000000ll;
  g.ww[1] = a / 10000000ll;
  g = g * a1;
  g = g * a2;
  return g;
}
Gao C4(long long int a) {
  if (a < 4) return Gao();
  long long int a1 = a - 1, a2 = a - 2, a3 = a - 3;
  if ((a & 3) == 0) {
    a >>= 2;
    a2 >>= 1;
  } else if ((a1 & 3) == 0) {
    a1 >>= 2;
    a3 >>= 1;
  } else if ((a2 & 3) == 0) {
    a2 >>= 2;
    a >>= 1;
  } else {
    a3 >>= 2;
    a1 >>= 1;
  }
  if (a % 3 == 0)
    a /= 3;
  else if (a1 % 3 == 0)
    a1 /= 3;
  else
    a2 /= 3;
  Gao g = Gao();
  g.ww[0] = a % 10000000ll;
  g.ww[1] = a / 10000000ll;
  g = g * a1;
  g = g * a2;
  g = g * a3;
  return g;
}
inline Gao D(long long int x1, long long int x2, long long int y) {
  if (x2 < y) return Gao();
  if (x1 < y) x1 = y;
  Gao ret = 6 * (C4(x2 + 1) - C4(x1)) + (7 - (y << 1)) * (C3(x2 + 1) - C3(x1)) +
            (2 - y) * (C2(x2 + 1) - C2(x1)) + (x2 - x1 + 1) * C2(y - 1);
  return ret;
}
inline Gao E(long long int x, long long int y1, long long int y2) {
  if (y2 <= x) return Gao();
  if (y1 <= x) y1 = x + 1;
  Gao ret = 6 * (C4(y2 + 1) - C4(y1)) + (3 - (x << 1)) * (C3(y2 + 1) - C3(y1)) +
            x * (C2(y2 + 1) - C2(y1)) - (y2 - y1 + 1) * C2(x + 1);
  return ret;
}
void shuchu(const Gao &a) {
  long long int i, j;
  for (i = 6; i > 0 && a.ww[i] == 0; i--)
    ;
  if (i == 0) {
    printf("%I64d\n", a.ww[0]);
    return;
  }
  if (i > 1 || (i == 1 && a.ww[1] >= 1000)) {
    printf("...");
    i = a.ww[1] % 1000;
    for (j = 10; j < 1000 && i * j < 1000; j *= 10) printf("0");
    printf("%I64d", i);
  } else
    printf("%I64d", a.ww[1]);
  i = a.ww[0];
  for (j = 10; j < 10000000ll && i * j < 10000000ll; j *= 10) printf("0");
  printf("%I64d\n", i);
}
void work() {
  long long int x1, x2, Y1, y2;
  scanf("%I64d%I64d%I64d%I64d", &x1, &Y1, &x2, &y2);
  if (y2 <= x1) {
    shuchu(D(x1, x2, Y1) - D(x1, x2, y2 + 1));
    return;
  }
  if (x2 < Y1) {
    shuchu(E(x1, Y1, y2) - E(x2 + 1, Y1, y2));
    return;
  }
  if (Y1 <= x1 && y2 <= x2) {
    shuchu(D(x1, x2, Y1) - D(y2, x2, y2 + 1) + E(x1, x1, y2));
    return;
  }
  if (Y1 <= x1 && x2 < y2) {
    shuchu(D(x1, x2, Y1) - E(x2 + 1, x2, y2) + E(x1, x1, y2));
    return;
  }
  if (x1 < Y1 && y2 <= x2) {
    shuchu(D(Y1, x2, Y1) - D(y2, x2, y2 + 1) + E(x1, Y1, y2));
    return;
  }
  if (x1 < Y1 && x2 < y2) {
    shuchu(D(Y1, x2, Y1) - E(x2 + 1, x2, y2) + E(x1, Y1, y2));
    return;
  }
}
int main() {
  int tn;
  scanf("%d", &tn);
  while (tn--) work();
  return 0;
}
