#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int inf = 0x3f3f3f3f;
long long infl = 0x3f3f3f3f3f3f3f3fLL;
long double infd = 1.0 / 0.0;
const long long MOD = 1e9 + 7;
const long double pi = 2 * acos(0.0);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  int tt = 1;
  cin >> tt;
  while (tt--) {
    long long a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    if (a > b) {
      swap(a, b);
      swap(x, y);
    } else if (a == b) {
      if (y < x) swap(x, y);
    }
    long long as;
    long long ope = a - x;
    ope = min(ope, n);
    long long z = a - ope;
    long long ope2 = b - y;
    ope2 = min(ope2, n);
    long long z2 = b - ope2;
    long long kk = b - y;
    kk = min(n - ope, kk);
    long long zz2 = b - kk;
    as = z * zz2;
    kk = a - x;
    kk = min(n - ope2, kk);
    zz2 = a - kk;
    long long as2 = z2 * zz2;
    cout << min(as2, as) << '\n';
  }
  return 0;
}
