#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    int a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    if (a - x + b - y <= n) {
      cout << x * 1LL * y << '\n';
      continue;
    }
    int t1 = a - x, t2 = b - y;
    long long ans1 = (a - min(n, t1)) * 1LL * (b - n + min(n, t1));
    long long ans2 = (b - min(n, t2)) * 1LL * (a - n + min(n, t2));
    cout << min(ans1, ans2) << '\n';
  }
  return 0;
}
