#include <bits/stdc++.h>
using namespace std;
void fre() {
  freopen("c://test//input.in", "r", stdin);
  freopen("c://test//output.out", "w", stdout);
}
template <class T1, class T2>
inline void gmax(T1 &a, T2 b) {
  if (b > a) a = b;
}
template <class T1, class T2>
inline void gmin(T1 &a, T2 b) {
  if (b < a) a = b;
}
const int N = 2e5 + 10, M = 0, Z = 1e9 + 7, ms63 = 0x3f3f3f3f;
int n, k;
int a[N];
long long c5, c1;
int main() {
  while (~scanf("%d%d%lld%lld", &n, &k, &c5, &c1)) {
    gmin(c5, c1 * 5);
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), a[i] += 1e9;
    sort(a + 1, a + n + 1);
    long long ans = 4e17;
    for (int mod = 0; mod < 5; ++mod) {
      priority_queue<long long> q;
      long long sum = 0;
      for (int i = 1; i <= n; ++i) {
        int aim = (a[i] + 4) / 5 * 5;
        long long cost = (aim - a[i]) * c1 - aim / 5 * c5;
        sum += cost;
        q.push(cost);
        if (q.size() == k) {
          gmin(ans, sum + aim / 5 * c5 * k);
          sum -= q.top();
          q.pop();
        }
      }
      for (int i = 1; i <= n; ++i) ++a[i];
    }
    printf("%lld\n", ans);
  }
  return 0;
}
