#include <bits/stdc++.h>
using namespace std;
double esp = 1e-11;
const double PI = acos(-1.0);
const long long int INF = 0x3f3f3f3f3f3f3f3f;
const long long int MOD = 1e9 + 7ll;
const int maxn = 210000;
long long int m[maxn];
queue<long long int> qu[5];
long long int b, c;
long long int cal(long long int t, long long int x) {
  return (x - t) / 5 * b + (x - t) % 5 * c;
}
int main() {
  long long int n, k;
  scanf("%I64d%I64d%I64d%I64d", &n, &k, &b, &c);
  if (b > 5 * c) b = 5 * c;
  for (int x = 1; x <= n; x++) scanf("%I64d", &m[x]);
  sort(m + 1, m + n + 1);
  long long int len, p, p1, ma;
  long long int ans = INF, tem, tem1;
  if (m[1] < 0) {
    tem = -m[1];
    for (int x = 1; x <= n; x++) m[x] += tem;
  }
  for (int r = 0; r <= 4; r++) {
    for (int x = 0; x <= 4; x++)
      while (!qu[x].empty()) qu[x].pop();
    len = 0;
    tem = 0;
    for (int x = 1; x <= n; x++) {
      for (int y = 0; y <= 4; y++)
        if ((m[x] + y) % 5 == r) {
          tem1 = m[x] + y;
          break;
        }
      tem += len * ((tem1 - p) / 5) * b;
      p = tem1;
      qu[m[x] % 5].push(m[x]);
      len++;
      tem += cal(m[x], p);
      while (len > k) {
        p1 = -1;
        ma = 0;
        for (int y = 0; y <= 4; y++)
          if ((!qu[y].empty()) && cal(qu[y].front(), p) > ma) {
            p1 = y;
            ma = cal(qu[y].front(), p);
          }
        qu[p1].pop();
        len--;
        tem -= ma;
      }
      if (len == k) ans = min(ans, tem);
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
