#include <bits/stdc++.h>
using namespace std;
long long T;
long long read() {
  long long x = 0, k = 1;
  char c;
  c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') k = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0', c = getchar();
  }
  return x * k;
}
signed main() {
  T = read();
  while (T--) {
    long long a = read(), b = read(), x = read(), y = read(), n = read(), ans;
    if (a - x + b - y <= n)
      printf("%lld\n", x * y);
    else {
      long long p1 = max(0LL, y + n - b), p2 = min(n, a - x);
      ans = min((a - p1) * (b - n + p1), (a - p2) * (b - n + p2));
      printf("%lld\n", ans);
    }
  }
  return 0;
}
