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