#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const long long LLINF = 2e18;
const int MAXN = 2e5 + 5;
int a[MAXN];
multiset<long long> s;
inline int mod(int cur, int modd) {
  int k = cur % modd;
  if (k < 0) k += modd;
  return k;
}
int main() {
  int n, k;
  long long b, c;
  scanf(
      "%d%d"
      "%lld"
      "%lld",
      &n, &k, &b, &c);
  b = min(b, 5 * c);
  for (int i = 0; (i) < (n); ++i) scanf("%d", &a[i]);
  sort(a, a + n);
  long long ans = LLINF;
  for (int q = 0; (q) < (5); ++q) {
    s.clear();
    long long hold = 0;
    int last = -INF;
    long long curAns = 0;
    for (int i = 0; (i) < (n); ++i) {
      int cur = a[i];
      while (mod(cur, 5) != q) cur++;
      if (last != -INF) hold += (cur - last) / 5 * b;
      while (i < n && a[i] <= cur) {
        if ((int)((s).size()) < k) {
          s.insert((cur - a[i]) * c - hold);
          curAns += (cur - a[i]) * c - hold;
        } else if (*(--s.end()) > (cur - a[i]) * c - hold) {
          curAns += (cur - a[i]) * c - hold - *(--s.end());
          s.erase(--s.end());
          s.insert((cur - a[i]) * c - hold);
        }
        i++;
      }
      i--;
      if ((int)((s).size()) == k) ans = min(ans, curAns + hold * k);
      last = cur;
    }
  }
  printf(
      "%lld"
      "\n",
      ans);
  return 0;
}
