#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int test;
  cin >> test;
  while (test--) {
    long long a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    if (x > y) swap(x, y), swap(a, b);
    if (a - x + b - y <= n)
      cout << x * y << '\n';
    else {
      long long temp1, temp2;
      long long tn = n;
      if (a - tn >= x)
        temp1 = (a - tn) * b;
      else {
        tn -= (a - x);
        temp1 = x * max(y, b - tn);
      }
      tn = n;
      if (b - tn >= y)
        temp2 = (b - tn) * a;
      else {
        tn -= (b - y);
        temp2 = y * max(x, a - tn);
      }
      cout << min(temp1, temp2) << '\n';
    }
  }
  return 0;
}
