#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int tc;
  cin >> tc;
  while (tc--) {
    long long n, a, b, x, y;
    cin >> a >> b >> x >> y >> n;
    long long diff1, diff2;
    diff1 = a - x;
    diff2 = b - y;
    long long mn1 = min(diff1, n);
    long long mn2 = min(diff2, n);
    long long p;
    p = min(abs(n - mn1), mn2);
    long long c;
    c = min(abs(n - mn2), mn1);
    long long d = (a - mn1) * (b - p);
    long long d1 = (a - c) * (b - mn2);
    cout << min(d1, d) << endl;
  }
}
