#include <bits/stdc++.h>
using namespace std;
const long long INF = 1ll << 32;
const double pi = acos(-1);
int dc[] = {0, 0, 1, -1}, dr[] = {1, -1, 0, 0};
void yes() {
  printf("YES\n");
  return;
}
void no() {
  printf("NO\n");
  return;
}
void line() {
  printf("\n");
  return;
}
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  return GCD(b, a % b);
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int a, b, x, y, n;
    scanf("%d %d %d %d %d", &a, &b, &x, &y, &n);
    int n1 = n;
    long long ans1, ans2;
    int o = min(a - x, n);
    int a1 = a, b1 = b;
    n -= o;
    a -= o;
    b -= n;
    b = max(b, y);
    ans1 = (long long)a * b;
    o = min(b1 - y, n1);
    n1 -= o;
    b1 -= o;
    a1 -= n1;
    a1 = max(a1, x);
    ans2 = (long long)a1 * b1;
    printf("%lld\n", min(ans1, ans2));
  }
  return 0;
}
