#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int T;
  cin >> T;
  while (T--) {
    long long a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    if (a - x + b - y < n) {
      cout << x * y << "\n";
      continue;
    }
    long long t = 0, X = 0;
    X = min(n, b - y);
    t = (a - (n - X)) * (b - X);
    X = 0;
    X = min(n, a - x);
    cout << min(t, (b - (n - X)) * (a - X)) << "\n";
  }
  return 0;
}
