//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;
}