#include <bits/stdc++.h>
using namespace std;
void set_min(int &a, int b) {
  if (b < a) a = b;
}
int main() {
  int t;
  scanf("%d\n", &t);
  while (t--) {
    long long a, b, x, y, n;
    scanf("%lld %lld %lld %lld %lld\n", &a, &b, &x, &y, &n);
    long long p1, p2;
    if (a >= n + x) {
      p1 = (a - n) * b;
    } else {
      if (b + a >= x + n + y)
        p1 = x * (b - x + a - n);
      else
        p1 = x * y;
    }
    if (b >= n + y) {
      p2 = (b - n) * a;
    } else {
      if (a + b >= y + n + x)
        p2 = y * (a - y + b - n);
      else
        p2 = x * y;
    }
    if (p2 < p1)
      cout << p2 << "\n";
    else
      cout << p1 << "\n";
  }
}
