#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
const long long int inf = 3e18;
long long int n, k, a, b;
bool compar(pair<long long int, long long int> &p1,
            pair<long long int, long long int> &p2) {
  if (p1.first < p2.first)
    return true;
  else if (p1.first > p2.first)
    return false;
  else {
    return (p1.second > p2.second);
  }
}
void solve() {
  cin >> n >> k >> a >> b;
  v.resize(n);
  for (long long int j = 0; j < n; j++) cin >> v[j];
  if (a >= 5 * b) {
    sort(v.begin(), v.end());
    long long int sum = 0;
    for (long long int j = 0; j < k; j++) sum += v[j];
    long long int ans = inf;
    ans = min(ans, (k * v[k - 1] - (sum)) * b);
    for (long long int j = k; j < n; j++) {
      sum += v[j];
      sum -= v[j - k];
      ans = min(ans, (k * v[j] - (sum)) * b);
    }
    cout << ans << "\n";
    return;
  }
  sort(v.begin(), v.end());
  long long int ans = inf;
  for (long long int mod = 0; mod < 5; mod++) {
    long long int modans = inf;
    multiset<long long int> s;
    long long int sum = 0;
    long long int val1;
    for (long long int j = 0; j < k; j++) {
      long long int cost = 0, val = v[j];
      long long int md = (v[j] % 5 + 5) % 5;
      if (md <= mod) {
        cost = (mod - md) * b;
      } else {
        cost = (5 - md + mod) * b;
      }
      val = v[j] + cost / b;
      val1 = val;
      s.insert(5 * cost - (a * val));
      sum += 5 * cost - (a * val);
    }
    modans = min(modans, (val1 * k * a) + sum);
    for (long long int j = k; j < n; j++) {
      long long int cost = 0, val = v[j];
      long long int md = (v[j] % 5 + 5) % 5;
      if (md <= mod) {
        cost = (mod - md) * b;
      } else {
        cost = (5 - md + mod) * b;
      }
      val = v[j] + cost / b;
      s.insert(5 * cost - (a * val));
      sum += 5 * cost - (a * val);
      sum -= *s.rbegin();
      s.erase(prev(s.end()));
      modans = min(modans, (val * k * a) + sum);
    }
    ans = min(modans, ans);
  }
  cout << ans / 5 << "\n";
  return;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
