#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, B, c;
  cin >> n >> k >> B >> c;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long x = *min_element(a, a + n);
  for (int i = 0; i < n; i++) a[i] = a[i] - x;
  B = min(B, 5 * c);
  long long ans = 1e18;
  for (int t = 0; t < 5; t++) {
    pair<long long, long long> b[n];
    for (int i = 0; i < n; i++) {
      b[i] = {a[i], 0};
      while (b[i].first % 5 != t) {
        b[i].first++;
        b[i].second += c;
      }
      b[i].first /= 5;
    }
    sort(b, b + n);
    priority_queue<long long> G;
    long long suma = 0;
    for (int i = 0; i < n; i++) {
      if (G.size() >= k - 1) {
        ans = min(ans, b[i].second + b[i].first * B * (k - 1) + suma);
      }
      G.push(b[i].second - b[i].first * B);
      suma += b[i].second - b[i].first * B;
      while (G.size() >= k) {
        suma -= G.top();
        G.pop();
      }
    }
  }
  cout << ans << "\n";
}
