#include <bits/stdc++.h>
using namespace std;
int n, k, b, c, a[200005];
long long ans = (long long)1 << 60, tmp[5];
priority_queue<long long> q[5];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = (x + (x << 2) << 1) + (ch ^ 48);
  return x * f;
}
int main() {
  n = read(), k = read(), b = read(), c = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1);
  if (b >= c * 5) {
    for (int i = 1; i <= k; i++)
      q[0].push(-(long long)a[i] * c), tmp[0] -= (long long)a[i] * c;
    ans = (long long)a[k] * k * c + tmp[0];
    for (int i = k + 1; i <= n; i++)
      tmp[0] -= (long long)a[i] * c + q[0].top(), q[0].pop(),
          q[0].push(-(long long)a[i] * c),
          ans = min(ans, (long long)a[i] * k * c + tmp[0]);
  } else {
    for (int i = 1; i <= k; i++)
      for (int j = 0; j < 5; j++) {
        int x = (j - a[i]) / 5, y = j - a[i] - x * 5;
        long long z;
        if (y < 0) x--, y += 5;
        z = (long long)x * b + (long long)y * c;
        q[j].push(z), tmp[j] += z;
      }
    for (int i = a[k]; i < a[k] + 5; i++) {
      int x = i / 5, y = i - x * 5;
      if (y < 0) x--, y += 5;
      ans = min(ans, (long long)x * k * b + tmp[y]);
    }
    for (int i = k + 1; i <= n; i++) {
      for (int j = 0; j < 5; j++) {
        int x = (j - a[i]) / 5, y = j - a[i] - x * 5;
        long long z;
        if (y < 0) x--, y += 5;
        z = (long long)x * b + (long long)y * c;
        if (z < q[j].top()) tmp[j] += z - q[j].top(), q[j].pop(), q[j].push(z);
      }
      for (int j = a[i]; j < a[i] + 5; j++) {
        int x = j / 5, y = j - x * 5;
        if (y < 0) x--, y += 5;
        ans = min(ans, (long long)x * k * b + tmp[y]);
      }
    }
  }
  printf("%lld", ans);
  return 0;
}
