include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
int n,a,b,c,d,e,f;
int main()
{
cin>>n;
while(n--)
{
int res=0;
cin>>a>>b>>c>>d>>e>>f;
if(e>=f)
{
int mini=min(a,d);
res+=mini*e;
d-=mini;
mini=min(b,c);
mini=min(mini,d);
res+=mini*f;
}
else
{
int mini=min(b,c);
mini=min(mini,d);
res+=mini*f;
d-=mini;
mini=min(a,d);
res+=mini*e;
}
cout<<res<<endl;
}
return 0;
}