#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    long long mymin1 = max(x, a - n);
    long long mymin2 = max(y, b - n);
    long long mymin = min(mymin1, mymin2);
    long long used;
    if (mymin1 == mymin) {
      used = a - mymin1;
      if (n - used > 0) b = max(y, b - (n - used));
      cout << mymin * b << endl;
    } else {
      used = b - mymin2;
      if (n - used > 0) a = max(x, a - (n - used));
      cout << mymin * a << endl;
    }
  }
}
