#include <bits/stdc++.h>
using namespace std;
void solve()
{
int c1, c2, c3, c4;
int n, m;
if (c4 < c1 && c4 < c2 && c4 < c3)
{
cout << c4 << "\n";
return;
}
cin >> c1 >> c2 >> c3 >> c4;
cin >> n >> m;
int a[n];
int b[m];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
for (int i = 0; i < m; i++)
{
cin >> b[i];
}
int tot_rickshaw_cost = 0;
for (int i = 0; i < n; i++)
{
tot_rickshaw_cost += min((a[i] * c1), c2);
}
tot_rickshaw_cost = min(tot_rickshaw_cost, c3);
int tot_cab_cost = 0;
for (int i = 0; i < m; i++)
{
tot_cab_cost += min((b[i] * c1), c2);
}
tot_cab_cost = min(tot_cab_cost, c3);
int tot_cost = tot_rickshaw_cost + tot_cab_cost;
tot_cost = min(tot_cost, c4);
cout << tot_cost << "\n";
}
int main()
{
int t;
cin >> t;
while (t–)
{
solve();
}
}
//what is wrong in this code it is alright to the best of my //knowledge please help