#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--) {
    pair<long long, long long> a, b;
    long long n;
    cin >> a.first >> b.first >> a.second >> b.second >> n;
    long long ans;
    if (a.first - a.second >= n)
      ans = (a.first - n) * b.first;
    else
      ans = a.second * max(b.first - (n - a.first + a.second), b.second);
    if (b.first - b.second >= n)
      ans = min(ans, (b.first - n) * a.first);
    else
      ans = min(ans,
                (b.second * max(a.first - (n - b.first + b.second), a.second)));
    cout << ans << endl;
  }
}
