#include <bits/stdc++.h>
using namespace std;
long long n, m, k, x, y, xx, yy, xy, v = 1e60, a[1000005], b[1000005];
priority_queue<long long, vector<long long> > q;
long long dis(long long x_, long long y_) {
  return (y_ - x_) / 5 * x + (y_ - x_) % 5 * y;
}
void work(long long x_) {
  long long uv = (x_ - xx) / 5 * x, xv = (long long)1e60;
  while (a[yy + 1] <= x_ && yy + 1 <= n) {
    q.push(dis(a[yy + 1], x_) - uv);
    xy += dis(a[yy + 1], x_) - uv;
    if (q.size() > k) {
      xy -= q.top();
      q.pop();
    }
    if (q.size() == k) xv = min(xv, uv * k + xy);
    yy++;
  }
  v = min(v, xv);
  return;
}
signed main() {
  cin >> n >> k >> x >> y;
  x = min(x, y * 5);
  for (long long i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (long long i = 1; i <= n; i++)
    for (long long j = a[i]; j <= a[i] + 4; j++) b[++m] = j;
  sort(b + 1, b + m + 1);
  for (long long i = 0; i <= 4; i++) {
    xx = i - 1000000000;
    yy = xy = 0;
    while (!q.empty()) q.pop();
    for (long long j = 1; j <= m; j++)
      if ((b[j] % 5 + 5) % 5 == i) work(b[j]);
  }
  cout << v << endl;
  return 0;
}
