#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const long long inf = 1000000007;
struct element {
  long long val, price;
  int idx;
};
bool comparePrice(element A, element B) { return A.price < B.price; }
bool compareValue(element A, element B) { return A.val < B.val; }
struct node {
  long long sum, cnt;
};
int N, K;
long long B, C;
long long x[MAXN];
element a[MAXN];
node tree[4 * MAXN];
vector<long long> cand;
long long solveOnes() {
  sort(x + 1, x + N + 1);
  long long Sum = 0;
  long long ans = inf * inf;
  x[0] = 0;
  for (int i = 1; i <= N; i++) {
    Sum += x[i];
    if (i < K) continue;
    Sum -= x[i - K];
    long long incr = x[i] * K - Sum;
    ans = min(ans, C * incr);
  }
  return ans;
}
void BuildTree(int v, int tl, int tr) {
  if (tl == tr)
    tree[v].cnt = tree[v].sum = 0;
  else {
    int mid = (tl + tr) / 2;
    BuildTree(2 * v, tl, mid);
    BuildTree(2 * v + 1, mid + 1, tr);
    tree[v].cnt = tree[v].sum = 0;
  }
}
long long getVal(long long x, long long rem) {
  for (long long i = 0; i < 5; i++) {
    if ((x + i) % 5 == rem) return x + i;
  }
}
long long getPrice(long long x, long long rem) {
  long long y = getVal(x, rem);
  return 5LL * (y - x) * C - B * y;
}
void Insert(int v, int tl, int tr, long long val, int pos) {
  if (tl == tr) {
    tree[v].cnt++;
    tree[v].sum = val;
  } else {
    int mid = (tl + tr) / 2;
    if (pos <= mid)
      Insert(2 * v, tl, mid, val, pos);
    else
      Insert(2 * v + 1, mid + 1, tr, val, pos);
    tree[v].cnt = tree[2 * v].cnt + tree[2 * v + 1].cnt;
    tree[v].sum = tree[2 * v].sum + tree[2 * v + 1].sum;
  }
}
long long getSum(int v, int tl, int tr, int l, int r, int need) {
  if (need <= 0 || l > tr || tl > r) return 0;
  l = max(l, tl);
  r = min(r, tr);
  if (tl == l && tr == r && (int)tree[v].cnt == need) return tree[v].sum;
  int mid = (tl + tr) / 2;
  int takeL = min(need, (int)tree[2 * v].cnt);
  int takeR = need - takeL;
  return getSum(2 * v, tl, mid, l, r, takeL) +
         getSum(2 * v + 1, mid + 1, tr, l, r, takeR);
}
int main() {
  cin >> N >> K;
  cin >> B >> C;
  for (int i = 1; i <= N; i++) {
    cin >> x[i];
    x[i] += inf;
    for (int j = 0; j < 5; j++) cand.push_back(x[i] + (long long)j);
  }
  if (B >= 5 * C) {
    cout << solveOnes() << endl;
  } else {
    sort(cand.begin(), cand.end());
    long long ans = inf * inf;
    for (int rem = 0; rem < 5; rem++) {
      BuildTree(1, 1, N);
      for (int i = 1; i <= N; i++) {
        a[i].val = getVal(x[i], rem);
        a[i].price = getPrice(x[i], rem);
      }
      sort(a + 1, a + N + 1, comparePrice);
      for (int i = 1; i <= N; i++) a[i].idx = i;
      sort(a + 1, a + N + 1, compareValue);
      int pntA = 1;
      int pntC = 0;
      while (pntC < cand.size()) {
        if (cand[pntC] % 5 != rem) {
          pntC++;
          continue;
        }
        while (pntA <= N && a[pntA].val <= cand[pntC]) {
          Insert(1, 1, N, a[pntA].price, a[pntA].idx);
          pntA++;
        }
        if (tree[1].cnt >= K) {
          ans = min(
              ans,
              (getSum(1, 1, N, 1, N, K) + (long long)K * B * (cand[pntC])) / 5);
        }
        pntC++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
