#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int T;
int a,b,c,d,e,f;
int main()
{
cin>>T;
while(T--)
{
cin>>a>>b>>c>>d>>e>>f;
int res=0;
if(e>f) //ad bcd
{
int d1=min(a,d);
res+=d1*e;
d-=d1;
res+=min(min(b,c),d)*f;
}
else
{
int d2=min(min(b,c),d);
res+=d2*f;
d-=d2;
res+=(min(a,d))*e;
}
cout<<res<<endl;
}
}