#include <bits/stdc++.h>
using namespace std;
int main() {
  int tt;
  cin >> tt;
  while (tt--) {
    long long a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    long long q = a, w = b, e = x, r = y, t = n;
    long long c = w;
    w -= min(t, w - r);
    t -= min(t, c - r);
    c = q;
    q -= min(t, q - e);
    t -= min(t, c - e);
    long long ans1 = q * w;
    q = a, w = b, e = x, r = y, t = n;
    c = q;
    q -= min(t, q - e);
    t -= min(t, c - e);
    c = w;
    w -= min(t, w - r);
    t -= min(t, c - r);
    long long ans2 = q * w;
    cout << min(ans1, ans2) << endl;
  }
}
