#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long a, b, x, y, n;
    cin >> a >> b >> x >> y >> n;
    long long ans;
    if (a - x + b - y <= n)
      ans = x * y;
    else {
      if (a < b) {
        if (n <= a - x) {
          ans = (a - n) * b;
        } else {
          long long p = n;
          p -= (a - x);
          long long a1 = x * (b - p);
          if (n <= b - y)
            a1 = min(a1, (long long)((b - n) * a));
          else {
            n -= (b - y);
            a1 = min(a1, (long long)(y * (a - n)));
          }
          ans = a1;
        }
      } else {
        if (n <= b - y) {
          ans = (b - n) * a;
        } else {
          long long p = n;
          p -= (b - y);
          long long a1 = y * (a - p);
          if (n <= a - x)
            a1 = min(a1, (long long)((a - n) * b));
          else {
            n -= (a - x);
            a1 = min(a1, (long long)(x * (b - n)));
          }
          ans = a1;
        }
      }
    }
    cout << ans << endl;
  }
}
