#include <bits/stdc++.h>
using namespace std;
long long min(long long x, long long y) { return (x < y) ? x : y; }
int main() {
  long long t;
  cin >> t;
  for (int p = 0; p < t; p++) {
    long long a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    if (a < b) {
      int t = a;
      a = b;
      b = t;
      t = x;
      x = y;
      y = t;
    } else if (a == b && x < y) {
      int t = x;
      x = y;
      y = t;
    }
    if ((a - x) + (b - y) <= n) {
      cout << (x * y) << endl;
    } else if ((b - y) >= n) {
      cout << a * (b - n) << endl;
    } else {
      long long v1 = (y) * (a - (n - b + y));
      long long v2;
      if (a - x >= n) {
        v2 = (a - n) * b;
      } else {
        v2 = (x) * (b - (n - a + x));
      }
      cout << min(v1, v2) << endl;
    }
  }
  return 0;
}
