#include <bits/stdc++.h>
using namespace std;
struct BigNumber {
  long long X[8];
  void Set(int T) {
    memset(X, 0, sizeof(X));
    X[0] = T;
    int P = 0;
    while (X[P] >= 100000) {
      X[P + 1] = X[P] / 100000;
      X[P] %= 100000;
      P++;
    }
  }
  void Output() {
    bool Flag = false;
    for (int i = 2; !Flag && i < 8; i++) Flag = X[i];
    if (!Flag)
      cout << X[1] * 100000 + X[0] << endl;
    else {
      putchar('.');
      putchar('.');
      putchar('.');
      for (int i = 10000; i >= 1; i /= 10) putchar(X[1] / i % 10 + 48);
      for (int i = 10000; i >= 1; i /= 10) putchar(X[0] / i % 10 + 48);
      putchar('\n');
    }
  }
};
int Get() {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  int X = 0;
  while (c >= '0' && c <= '9') {
    X = X * 10 + c - 48;
    c = getchar();
  }
  return X;
}
BigNumber F(int X) {
  BigNumber Ans;
  Ans.Set(X);
  return Ans;
}
BigNumber operator*(BigNumber A, BigNumber B) {
  BigNumber Ans;
  memset(Ans.X, 0, sizeof(Ans.X));
  for (int i = 0; i < 8; i++)
    if (A.X[i])
      for (int j = 0; i + j < 8; j++) Ans.X[i + j] += A.X[i] * B.X[j];
  for (int i = 0; i < 8; i++)
    if (Ans.X[i] >= 100000) {
      Ans.X[i + 1] += Ans.X[i] / 100000;
      Ans.X[i] %= 100000;
    }
  return Ans;
}
BigNumber operator+(BigNumber A, BigNumber B) {
  BigNumber Ans;
  for (int i = 0; i < 8; i++) Ans.X[i] = A.X[i] + B.X[i];
  for (int i = 0; i < 8; i++)
    if (Ans.X[i] >= 100000) {
      Ans.X[i + 1] += Ans.X[i] / 100000;
      Ans.X[i] %= 100000;
    }
  return Ans;
}
BigNumber operator-(BigNumber A, BigNumber B) {
  BigNumber Ans;
  for (int i = 0; i < 8; i++) Ans.X[i] = A.X[i] - B.X[i];
  for (int i = 0; i < 8; i++)
    if (Ans.X[i] < 0) {
      Ans.X[i] += 100000;
      Ans.X[i + 1]--;
    }
  return Ans;
}
BigNumber operator+(BigNumber A, int B) {
  BigNumber Ans;
  for (int i = 0; i < 8; i++) Ans.X[i] = A.X[i];
  Ans.X[0] += B;
  int P = 0;
  while (Ans.X[P] >= 100000) {
    Ans.X[P + 1] += Ans.X[P] / 100000;
    Ans.X[P] %= 100000;
    P++;
  }
  return Ans;
}
BigNumber operator/(BigNumber A, int B) {
  BigNumber Ans;
  for (int i = 7, S = 0; i >= 0; i--) {
    S = S * 100000 + A.X[i];
    Ans.X[i] = S / B;
    S %= B;
  }
  return Ans;
}
BigNumber Square(int X) { return F(X) * F(X + 1) * F(X * 2 + 1) / 6; }
BigNumber Solve(int X, int Y) {
  if (!X || !Y) return F(0);
  BigNumber L = F(min(X, Y));
  BigNumber Ans = L * L * (L * L + 1) / 2;
  if (X < Y) {
    BigNumber Sum = Square(Y - 1) - Square(X - 1) + (Y - X);
    Ans = Ans + Sum * F(X) + F(Y - X) * F(X) * F(X - 1) / 2;
  }
  if (X > Y) {
    BigNumber Sum = Square(X) - Square(Y);
    Ans = Ans + Sum * F(Y) - F(X - Y) * F(Y) * F(Y - 1) / 2;
  }
  return Ans;
}
int main() {
  int Test = Get();
  while (Test--) {
    int X0 = Get() - 1, Y0 = Get() - 1, X1 = Get(), Y1 = Get();
    BigNumber Ans =
        (Solve(X0, Y0) + Solve(X1, Y1)) - (Solve(X0, Y1) + Solve(X1, Y0));
    Ans.Output();
  }
  return 0;
}
