#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
long long a[maxn], aa[maxn], bb, cc;
queue<int> q[5];
inline long long calc(long long x, long long y) {
  return (y - x) / 5 * bb + (y - x) % 5 * cc;
}
int main() {
  int k, n;
  scanf("%d%d%I64d%I64d", &n, &k, &bb, &cc);
  for (int i = (1); i <= (n); i++) {
    scanf("%I64d", &a[i]);
    a[i] += 1e9;
  }
  bb = min(bb, 5 * cc);
  long long ans = 1e18;
  sort(a + 1, a + 1 + n);
  for (int p = 0; p < 5; p++) {
    for (int i = (1); i <= (n); i++) {
      aa[i] = a[i];
      while (aa[i] % 5 != p) aa[i]++;
    }
    sort(aa + 1, aa + 1 + n);
    long long tmp = 0, tt;
    int cnt = 0, cur = 0;
    for (int i = 0; i < 5; i++) {
      while (!q[i].empty()) q[i].pop();
    }
    for (int i = 1; i <= n; i++) {
      tmp += cnt * calc(aa[i - 1], aa[i]);
      while (cur < n && a[cur + 1] <= aa[i]) {
        cnt++;
        cur++;
        tmp += calc(a[cur], aa[i]);
        q[a[cur] % 5].push(a[cur]);
      }
      while (cnt > k) {
        tt = 0;
        for (int j = 0; j < 5; j++)
          if (!q[j].empty()) {
            tt = max(tt, calc(q[j].front(), aa[i]));
          }
        for (int j = 0; j < 5; j++) {
          if (!q[j].empty() && tt == calc(q[j].front(), aa[i])) {
            q[j].pop();
            tmp -= tt;
            cnt--;
            break;
          }
        }
      }
      if (cnt >= k) ans = min(ans, tmp);
    }
  }
  cout << ans << endl;
  return 0;
}
