#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a,b,c,d,e,f;
int t;
cin>>t;
while(t--)
{
int ans1 = 0,ans2 = 0,num = 0;
cin>>a>>b>>c>>d>>e>>f;
num = d;
ans1 += min(a,num)*e,num -= min(a,num),ans1 += min(min(b,c),num)*f;
num = d;
ans2 += min(min(b,c),num)*f,num -= min(min(b,c),num),ans2 += min(a,num)*e;
cout<<max(ans1,ans2)<<endl;
}
return 0;
}