#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    if ((a == x && b == y)) {
      cout << a * b << "\n";
      continue;
    }
    n = min(n, (a - x) + (b - y));
    long long ans = 0;
    long long k1 = min(a - x, n);
    long long k2 = min(b - y, n);
    long long p1 = (a - k1) * 1ll * (b - (n - k1));
    long long p2 = (a - (n - k2)) * 1ll * (b - k2);
    ans = min(p1, p2);
    cout << ans << "\n";
  }
  return 0;
}
