#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll Solve1(int a, int b, int x, int y, int n, int reper) {
  ll result = numeric_limits<ll>::max();
  for (int i = max(reper - 10, 0); i <= min(reper + 10, n); ++i) {
    int a1 = max(x, a - i);
    int b1 = max(y, b - (n - i));
    result = min(result, 1LL * a1 * b1);
  }
  return result;
}
ll Solve2(int a, int b, int x, int y, int n) {
  int d1 = a - x;
  int steps = min(n, d1);
  a -= steps;
  n -= steps;
  int d2 = b - y;
  steps = min(n, d2);
  b -= steps;
  n -= steps;
  return 1LL * a * b;
}
void Solve() {
  int a, b, x, y, n;
  cin >> a >> b >> x >> y >> n;
  ll result = Solve1(a, b, x, y, n, 0);
  result = min(result, Solve1(a, b, x, y, n, n));
  result = min(result, Solve1(a, b, x, y, n, (a - b + n) / 2));
  result = min(result, Solve2(a, b, x, y, n));
  result = min(result, Solve2(b, a, y, x, n));
  cout << result << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  for (int t = 0; t < (int)(T); ++t) {
    Solve();
  }
  return 0;
}
