#include <bits/stdc++.h>
using namespace std;
long long int n, a, b;
long long int ar[200007];
int main() {
  long long int test, i, sum = 0, cnt = 0, c;
  cin >> test;
  while (test--) {
    cin >> n >> a >> b >> c;
    cout << max(max((n - (b + 1)) * a, n * (a - (c + 1))), max(c * (n), a * b))
         << endl;
  }
}
