#include <bits/stdc++.h>
using namespace std;
long long n, k, b, c;
vector<long long> t;
long long f(long long mod) {
  vector<pair<long long, long long> > arr(n);
  for (long long i = 0; i < n; i++) {
    arr[i] = {t[i], 0};
    long long tmp = t[i] % 5;
    if (tmp <= mod) {
      arr[i].first += mod - tmp;
      arr[i].second = (mod - tmp) * c;
    } else {
      arr[i].first += 5 + mod - tmp;
      arr[i].second = (5 + mod - tmp) * c;
    }
  }
  sort(arr.begin(), arr.end());
  vector<long long> t(n), cost(n);
  for (long long i = 0; i < n; i++) {
    t[i] = arr[i].first;
    cost[i] = arr[i].second;
  }
  long long ans = 1e18;
  set<pair<long long, long long> > d;
  long long sum = 0;
  long long prev = t[0];
  for (long long i = 0; i < n; i++) {
    sum += cost[i];
    sum += (t[i] - prev) / 5 * b * d.size();
    d.insert({cost[i] - (t[i] - t[0]) / 5 * b, i});
    if (d.size() > k) {
      auto p = *d.rbegin();
      d.erase(p);
      sum -= cost[p.second];
      sum -= (t[i] - t[p.second]) / 5 * b;
    }
    if (d.size() == k) ans = min(ans, sum);
    prev = t[i];
  }
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> b >> c;
  t.assign(n, 0);
  for (long long i = 0; i < n; i++) {
    cin >> t[i];
    t[i] += (long long)1e9;
  }
  b = min(b, 5 * c);
  long long ans = 1e18;
  for (long long i = 0; i < 5; i++) {
    ans = min(ans, f(i));
  }
  cout << ans << '\n';
}
