#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(12);
  int64_t n, k, b, c;
  cin >> n >> k >> b >> c;
  vector<int64_t> t(n);
  for (int64_t i = 0; i < n; i++) {
    cin >> t[i];
  }
  sort(t.begin(), t.end());
  int64_t cost = 1000000000000000000;
  if (b - 5 * c >= 0) {
    queue<int64_t> myc;
    myc.push(1000000000000000000);
    int64_t csum = myc.front();
    for (int64_t i = 0; i < n; i++) {
      int64_t newc = -t[i] * c;
      myc.push(newc);
      csum += newc;
      if (myc.size() > k) {
        int64_t foo = myc.front();
        csum -= foo;
        myc.pop();
        cost = min(t[i] * c * k + csum, cost);
      }
    }
    cout << cost << "\n";
    return 0;
  }
  for (int64_t m = 0; m < 5; m++) {
    multiset<int64_t> myc;
    myc.insert(1000000000000000000);
    int64_t csum = *(myc.begin());
    for (int64_t i = 0; i < n; i++) {
      int64_t y;
      if (t[i] - m < 0)
        y = (t[i] - m) / 5;
      else
        y = (t[i] - m + 4) / 5;
      int64_t newc;
      if (m - t[i] < 0)
        newc = (m - t[i] - 4) / 5 * (b - 5 * c) + (m - t[i]) * c;
      else
        newc = (m - t[i]) / 5 * (b - 5 * c) + (m - t[i]) * c;
      myc.insert(newc);
      csum += newc;
      if (myc.size() > k) {
        multiset<int64_t>::reverse_iterator iter = myc.rbegin();
        int64_t foo = *iter;
        csum -= foo;
        myc.erase(--iter.base());
        cost = min(y * b * k + csum, cost);
      }
    }
  }
  cout << cost << "\n";
  return 0;
}
