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