#include <bits/stdc++.h>
using namespace std;
long long i, j, n, k, q, a[228228], another[228228], pa[228228], b[228228], b1,
    c, x, y, d, h;
vector<long long> ost[10];
multiset<long long> f;
multiset<long long>::iterator itr;
long long Abs(long long x) { return x > 0 ? x : -x; }
int main() {
  cin >> n >> k >> b1 >> c;
  for (i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
    a[i] += 1000000000;
  }
  sort(a, a + n);
  if (5 * c < b1) {
    long long ans = (1LL + (long long)1e+18);
    for (i = 0; i < n; i++) pa[i + 1] = pa[i] + a[i];
    for (i = k - 1; i < n; i++)
      ans = min(ans, c * (k * a[i] - (pa[i + 1] - pa[i - k + 1])));
    cout << ans << endl;
    return 0;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < 5; j++) ost[(a[i] + j) % 5].push_back(a[i] + j);
  }
  long long ans = (1LL + (long long)1e+18);
  for (i = 0; i < 5; i++) {
    f.clear();
    for (j = 0; j < n; j++) {
      long long osta = (i - a[j] % 5 + 5) % 5;
      b[j] = -osta * c + ((a[j] + osta - i) / 5) * b1;
    }
    long long pnt = 0;
    long long sum = 0;
    for (j = 0; j < ost[i].size(); j++) {
      long long v = ost[i][j];
      while (a[pnt] <= v && pnt < n) {
        if (f.size() < k) {
          f.insert(b[pnt]);
          sum += b[pnt];
        } else {
          itr = f.begin();
          if ((*itr) < b[pnt]) {
            sum -= *itr;
            f.erase(itr);
            sum += b[pnt];
            f.insert(b[pnt]);
          }
        }
        pnt++;
      }
      if (f.size() == k) ans = min(ans, k * (b1 * (v - i) / 5) - sum);
    }
  }
  cout << ans << endl;
  return 0;
}
