#include <bits/stdc++.h>
using namespace std;
const int N = (int)6e6 + 15;
const int BASE = (int)20;
const int inf = 0x3f3f3f3f;
int t[N];
long long pref[N];
inline long long mceil(long long x, long long y) {
  return x / y + (x % y != 0);
}
int main() {
  int n, k, b, c;
  scanf("%d", &n), scanf("%d", &k), scanf("%d", &b), scanf("%d", &c);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t[i]);
  }
  sort(t + 1, t + 1 + n);
  for (int i = 1; i <= n; i++) {
    pref[i] = pref[i - 1] + t[i];
  }
  long long ans = (long long)9e18;
  for (int l = -(int)1e9 - 4; l <= -(int)1e9; l++) {
    long long x = l;
    long long delta = 0;
    multiset<long long> st;
    long long stSum = 0;
    for (int i = 1; i <= n; i++) {
      if (t[i] > x) {
        long long kk = mceil(t[i] - x, 5);
        delta += kk * b;
        x = x + 5 * kk;
      }
      long long cost = (x - t[i]) * c - delta;
      st.insert(cost);
      stSum += cost;
      if ((int)st.size() > k) {
        auto it = st.rbegin();
        stSum -= *it;
        st.erase(st.find(*it));
      }
      if ((int)st.size() == k) {
        ans = min(ans, stSum + k * delta);
      }
    }
  }
  for (int i = k; i <= n; i++) {
    ans = min(ans, 1LL * (1LL * k * t[i] - (pref[i] - pref[i - k])) * c);
  }
  printf("%lld\n", ans);
}
