aboutsummaryrefslogtreecommitdiff
path: root/codechef/chefInVaccinationQueue/chefInVaccinationQueue.cpp
blob: eb2bfdd7140969d607cfd26c3928a90439f1d72b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tt;
  cin >> tt;
  while (tt--) {
    int n, p, x, y;
    cin >> n >> p >> x >> y;
    vector<int> v(n);
    int ans = 0;
    for (int &x : v)
      cin >> x;
    for (int i = 0; i < p; i++) {
      if (v[i] == 0) {
        ans += x;
      } else {
        ans += y;
      }
    }
    cout << ans << endl;
  }
}