#include <bits/stdc++.h>
using namespace std;
void DBG() { cerr << "]\n"; }
template <typename T, typename... Args>
void DBG(T first, Args... args) {
  cerr << first;
  if (sizeof...(args)) cerr << ", ";
  DBG(args...);
}
void solve() {
  long long int a, b, x, y, n;
  cin >> a >> b >> x >> y >> n;
  if (b > a) {
    swap(a, b);
    swap(x, y);
  }
  if (b - n >= y) {
    long long int op1 = a * (b - n);
    cout << op1 << "\n";
  } else {
    long long int m = b - y;
    long long int r = n - m;
    long long int op1 = y * max(a - r, x);
    long long int used = min(n, a - x);
    long long int remain = n - used;
    long long int op2 = max(x, a - used) * max(y, b - remain);
    cout << min(op1, op2) << "\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int t = 1;
  cin >> t;
  for (long long int tt = 1; tt <= t; tt++) {
    solve();
  }
}
