#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll M = 1000000007;
const ll N = 998244353;
ll power(ll x, ll y, ll p) {
  ll res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
ll inv(ll x, ll m) { return power(x, m - 2, m); }
ll nCr(ll n, ll r) {
  vector<ll> fac(10);
  if (r == 0) return 1;
  return (fac[n] * inv(fac[r], M) % M * inv(fac[n - r], M) % M) % M;
}
struct comp {
  template <typename T>
  bool operator()(const T &a, const T &b) {
    if (a.first == b.first)
      return (a.second < b.second);
    else
      return (a.first < b.first);
  }
};
bool mod(const pair<ll, ll> &a, const pair<ll, ll> &b) {
  if (a.first != b.first)
    return (a.first < b.first);
  else
    return (a.second > b.second);
}
void sieve(ll mn, ll mx, vector<ll> &primes) {
  vector<bool> pr(100000 + 1, true);
  for (ll i = 2; i * i <= 100000; i++)
    if (pr[i] == 1)
      for (ll j = i * i; j <= 100000; j += i) pr[j] = 0;
  for (int i = 2; i < 100000; i++)
    if (pr[i]) primes.push_back(i);
}
bool isValid(ll i, ll j, vector<string> &v, ll n, ll m) {
  if (i >= 1 && i <= n && j >= 1 && j <= m) {
    return true;
  }
  return false;
}
void dfs(ll v, vector<vector<ll> > &adj, vector<bool> &vis) {
  vis[v] = true;
  for (int i = 0; i < (ll)((adj[v]).size()); i++) {
    if (!vis[adj[v][i]]) {
      dfs(adj[v][i], adj, vis);
    }
  }
}
ll n, m, k, num, num1, num2, flag = 0;
ll a, b, x, y;
ll func(ll a, ll b, ll x, ll y, ll n) {
  ll t = min(a, n);
  if (a - t < x) {
    n -= a - x;
    a = x;
  } else {
    n -= t;
    a = a - t;
  }
  t = min(b, n);
  if (b - t < y) {
    n -= b - y;
    b = y;
  } else {
    n -= t;
    b = b - t;
  }
  return a * b;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    cin >> a >> b >> x >> y >> n;
    cout << min(func(a, b, x, y, n), func(b, a, y, x, n)) << "\n";
  }
  return 0;
}
