#include <bits/stdc++.h>
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2")
using namespace std;
using ll = long long;
ll solve(ll a, ll b, ll x, ll y, ll n) {
  int f = min(n, a - x);
  int s = min(n - f, b - y);
  return (a - f) * 1LL * (b - s);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    ll a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    cout << min({solve(a, b, x, y, n), solve(b, a, y, x, n)}) << "\n";
  }
}
