#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  long long a, b, x, y, n;
  long long num1, num2;
  long long ans = 1e18;
  cin >> t;
  while (t--) {
    ans = 1e18;
    cin >> a >> b >> x >> y >> n;
    if (a > b) swap(a, b), swap(x, y);
    long long a1 = a, b1 = b, x1 = x, y1 = y, n1 = n;
    num1 = min(n1, a1 - x1);
    n1 -= num1;
    a1 -= num1;
    num2 = min(n1, b1 - y1);
    b1 -= num2;
    n1 -= num2;
    ans = min(ans, a1 * b1);
    a1 = a, b1 = b, x1 = x, y1 = y, n1 = n;
    num2 = min(n1, b1 - y1);
    b1 -= num2;
    n1 -= num2;
    num1 = min(n1, a1 - x1);
    n1 -= num1;
    a1 -= num1;
    ans = min(a1 * b1, ans);
    printf("%lld\n", ans);
  }
  getchar();
  getchar();
}
