#include <bits/stdc++.h>
using namespace std;
int T;
long long a, b, x, y, n, z;
long long A, B, X, Y, N, Z;
int main() {
  cin >> T;
  while (T--) {
    cin >> a >> b >> x >> y >> n;
    A = a - x;
    B = b - y;
    if (A >= n) {
      Z = a * b - n * b;
    } else {
      if (A + B <= n) {
        Z = x * y;
      } else {
        Z = x * (b - n + A);
      }
    }
    if (B >= n) {
      Z = min(Z, a * b - n * a);
    } else {
      if (A + B <= n) {
        Z = min(Z, x * y);
      } else {
        Z = min(Z, y * (a - n + B));
      }
    }
    cout << Z << endl;
  }
  return 0;
}
