#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int maxn = 1e6 + 10;
const int N = 1e2 + 5;
const long long inf = 0x3f3f3f3f;
const long long oo = 8e18;
const int dir[][2] = {{0, 1}, {1, 0},  {0, -1}, {-1, 0},
                      {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
long long a, b, x, y, n;
long long check(long long x) { return (a - x) * (b - (n - x)); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int _;
  cin >> _;
  while (_--) {
    cin >> a >> b >> x >> y >> n;
    if (n > a - x + b - y) {
      cout << x * y << '\n';
      continue;
    }
    long long l = max(y - b + n, 0ll), r = min(a - x, n);
    while (l + 10 < r) {
      long long lm = l + (r - l) / 3, rm = r - (r - l) / 3;
      if (check(lm) > check(rm))
        l = lm;
      else
        r = rm;
    }
    long long ans = 1e18;
    for (int i = l; i <= r; i++) ans = min(ans, check(i));
    cout << ans << '\n';
  }
  return 0;
}
