#include<iostream>
#include<algorithm>
using namespace std;
class solution
{
public:
void solve()
{
int n, p, x, y;
cin >> n >> p >> x >> y;
int* arr = new int[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
int total = 0;
for (int i = 0; i < p; i++)
{
if (arr[i] == 1)
total += y;
else
total += x;
}
cout << total << "
";
}
};
int main()
{
solution ss;
int t;
cin >> t;
while (t--)
{
ss.solve();
}
return 0;
}