#include <bits/stdc++.h>
using namespace std;
void solve() {}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    long long a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    if (a == b) {
      long long min_r = min(x, y);
      long long max_r = max(x, y);
      long long temp = min(a - min_r, n);
      a -= temp;
      n -= temp;
      b -= min(b - max_r, n);
      cout << a * b << "\n";
    } else {
      long long x1 = x, y1 = y, b1 = b, a1 = a, n1 = n, t1, t2;
      {
        long long mini = min(b - y, n);
        b -= mini;
        n -= mini;
        a -= min(a - x, n);
        t1 = a * b;
      }
      {
        long long mini = min(a1 - x1, n1);
        a1 -= mini;
        n1 -= mini;
        b1 -= min(b1 - y1, n1);
        t2 = a1 * b1;
      }
      cout << min(t1, t2) << "\n";
    }
    solve();
  }
  return 0;
}
