#include <bits/stdc++.h>
using namespace std;
const int N = 10 + 200000;
int n, k, b, c;
int t[N], r[N], nt[N];
queue<int> q[5];
long long Cost(int s, int t) {
  return (long long)b * ((t - s) / 5) + (long long)c * ((t - s) % 5);
}
int main() {
  scanf("%d %d %d %d", &n, &k, &b, &c);
  b = min(b, 5 * c);
  for (int i = 0; i < n; ++i) scanf("%d", t + i);
  sort(t, t + n);
  for (int i = 0; i < n; ++i) {
    r[i] = (t[i] % 5 + 5) % 5;
  }
  long long ans = (long long)9e18;
  for (int rot = 0; rot < 5; ++rot) {
    for (int i = 0; i < 5; ++i)
      while (!q[i].empty()) q[i].pop();
    for (int i = 0; i < n; ++i) {
      int shift = (rot - r[i] + 5) % 5;
      nt[i] = t[i] + shift;
    }
    long long total = 0;
    int w = 0;
    for (int i = 0; i < n; ++i) {
      if (i && nt[i] > nt[i - 1]) {
        long long value = (long long)b * (nt[i] - nt[i - 1]) / 5;
        total += value * min(k, w);
      }
      while (w < n && t[w] <= nt[i]) {
        total += Cost(t[w], nt[i]);
        q[r[w]].push(t[w]);
        if (w >= k) {
          long long best = 0;
          for (int j = 0; j < 5; ++j)
            if (!q[j].empty()) best = max(best, Cost(q[j].front(), nt[i]));
          for (int j = 0; j < 5; ++j)
            if (!q[j].empty() && Cost(q[j].front(), nt[i]) == best) {
              q[j].pop();
              total -= best;
              break;
            }
        }
        if (w >= k - 1) ans = min(ans, total);
        w++;
      }
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
