#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, x, y, n, i, j;
    cin >> a >> b >> x >> y >> n;
    i = (max(a - n, x)) * (max(y, b - (n - a + max(a - n, x))));
    j = (max(b - n, y)) * (max(x, a - (n - b + max(b - n, y))));
    cout << min(i, j) << endl;
  }
}
