#include <bits/stdc++.h>
long long int xx(long long int a, long long int b) {
  if (a >= b) {
    return a - b;
  } else {
    return 0;
  }
}
int main() {
  long long int ans1, ans2;
  long long int t, a, b, c, d, x, y, p, q, m, n;
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld%lld%lld%lld%lld", &a, &b, &c, &d, &x);
    m = b - d;
    n = a - c;
    ans1 = (d + xx(m, x)) * (c + xx(n, xx(x, m)));
    ans2 = (c + xx(n, x)) * (d + xx(m, xx(x, n)));
    if (ans1 >= ans2) {
      printf("%lld\n", ans2);
    } else {
      printf("%lld\n", ans1);
    }
  }
  return 0;
}
