#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    long a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    long long m = 1e18;
    for (int i = 0; i < 2; i++) {
      int a1 = min(n, a - x);
      int b1 = min(n - a1, b - y);
      m = min(m, (a - a1) * 1ll * (b - b1));
      swap(a, b);
      swap(x, y);
    }
    cout << m << endl;
  }
  return 0;
}
