#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, a, b, x, y;
    cin >> a >> b >> x >> y >> n;
    if (a > b) {
      swap(a, b);
      swap(x, y);
    } else if (a == b && x > y) {
      swap(a, b);
      swap(x, y);
    }
    long long temp = min(a - x, n);
    long long tn = n - temp;
    long long ta = a - temp;
    temp = min(tn, b - y);
    long long ans1 = (b - temp) * ta;
    temp = min(b - y, n);
    n -= temp;
    b -= temp;
    temp = min(a - x, n);
    a -= temp;
    long long ans2 = a * b;
    cout << min(ans1, ans2) << endl;
  }
}
