#include <bits/stdc++.h>
using namespace std;
int n, k, b, c, a[200005];
long long ans = LLONG_MAX;
int main() {
  cin >> n >> k >> b >> c;
  b = min(b, c * 5);
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (int i = 0; i < 5; i++) {
    long long calc = 0;
    priority_queue<long long> pq;
    for (int j = 1; j <= n; j++) {
      int t = a[j];
      int cost = 0;
      while ((t - i) % 5 != 0) t++, cost += c;
      pq.push(1ll * cost * 5 - 1ll * b * t);
      calc += 1ll * cost * 5 - 1ll * b * t;
      if (pq.size() > k) calc -= pq.top(), pq.pop();
      if (pq.size() == k) ans = min(ans, calc + 1ll * t * k * b);
    }
  }
  cout << ans / 5 << '\n';
  return 0;
}
