#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m, f, x, a, b, y, p, q, r, s, t;
  cin >> a >> b >> x >> y >> n;
  p = a, q = b, r = x, s = y, t = n;
  n = a + b - x - y - n;
  n = max(n, (long long)0);
  m = x;
  x += n;
  x = min(a, x);
  n -= (x - m);
  n = max(n, (long long)0);
  m = y;
  y += n;
  y = min(b, y);
  f = x * y;
  a = p, b = q, x = r, y = s, n = t;
  n = a + b - x - y - n;
  n = max(n, (long long)0);
  m = y;
  y += n;
  y = min(b, y);
  n -= (y - m);
  n = max(n, (long long)0);
  m = x;
  x += n;
  x = min(a, x);
  f = min(f, x * y);
  cout << f << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
