//by Vanjape Rajas Mangesh
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef pair<LL ,LL > II;
typedef vector< II > VII;
typedef vector<int> VI;
typedef vector< VI > VVI;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
LL x[4],y[4],arr0[3],arr1[3];
II func(LL a,LL b)
{
LL xx=1,yy=1;
if(a<0)
xx=-1;
if(b<0)
yy=-1;
return MP(xx*(max(abs(a)-1,0LL)/x[1]+(a<0)),yy*(max(abs(b)-1,0LL)/y[1]+(b<0)));
}
LL getarea(LL x1,LL y1,LL x2,LL y2)
{
LL a=max(0LL,min(x2,x[3])-max(x1,x[2]));
LL b=max(0LL,min(y2,y[3])-max(y1,y[2]));
// trace(x1,y1,x2,y2,a*b);
return a*b;
}
int main()
{
LL t;
cin>>t;
while(t--)
{
LL k;
for(LL i=0;i<4;i++)
{
cin>>x[i]>>y[i];
}
x[3]+=x[2],y[3]+=y[2];
x[1]+=x[0],y[1]+=y[0];
for(LL i=3;i>=0;i--)
{
x[i]-=x[0],y[i]-=y[0];
}
cin>>k;
arr0[0]=-x[1],arr0[1]=0,arr0[2]=x[1];
arr1[0]=-y[1],arr1[1]=0,arr1[2]=y[1];
LL mx=0;
for(LL l=2;l<4;l++)
for(LL m=2;m<4;m++)
for(LL i=0;i<3;i++)
for(LL j=0;j<3;j++)
{
II tmp=func(x[l]+arr0[i],y[m]+arr1[j]);
LL temp=getarea(tmp.F*x[1],tmp.S*y[1],(tmp.F+1)*x[1],(tmp.S+1)*y[1]);
if(mx<temp && abs(tmp.F)+abs(tmp.S)<=k)
mx=temp;
}
for(LL i=0;i<3;i++)
for(LL j=0;j<3;j++)
{
LL temp=getarea(arr0[i],arr1[j],arr0[i]+x[1],arr1[j]+y[1]);
II tmp;
tmp.F=arr0[i]/x[1];
tmp.S=arr1[j]/y[1];
if(mx<temp && abs(tmp.F)+abs(tmp.S)<=k)
mx=temp;
}
// cout<<mx<<"\n";
if(x[2]<0&&0<x[3])
{
x[2]=0;
}
if(y[2]<0&&0<y[3])
{
y[2]=0;
}
for(LL l=2;l<4;l++)
for(LL m=2;m<4;m++)
for(LL i=0;i<3;i++)
for(LL j=0;j<3;j++)
{
II tmp=func(x[l]+arr0[i],y[m]+arr1[j]);
LL temp=getarea(tmp.F*x[1],tmp.S*y[1],(tmp.F+1)*x[1],(tmp.S+1)*y[1]);
if(mx<temp && abs(tmp.F)+abs(tmp.S)<=k)
mx=temp;
}
cout<<mx<<"\n";
}
return 0;
}
Ly9ieSBWYW5qYXBlIFJhamFzIE1hbmdlc2gKCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBsb25nIGxvbmcgaW50CUxMOwp0eXBlZGVmIHBhaXI8TEwgLExMID4gICBJSTsKdHlwZWRlZiB2ZWN0b3I8IElJID4gICAgICBWSUk7CnR5cGVkZWYgdmVjdG9yPGludD4gICAgIFZJOwp0eXBlZGVmIHZlY3RvcjwgVkkgPiAJVlZJOwoKI2RlZmluZSBQQiBwdXNoX2JhY2sKI2RlZmluZSBNUCBtYWtlX3BhaXIKI2RlZmluZSBGIGZ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