#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200010;
long long N, K, B, C;
long long T[MAXN];
long long res = 1ll << 60;
void solve(vector<pair<long long, long long> >& l) {
  priority_queue<long long> mem;
  long long sum = 0;
  while (!l.empty()) {
    long long cur = l.back().first;
    while (l.back().first == cur) {
      long long ne = l.back().second;
      l.pop_back();
      if (mem.size() < K) {
        mem.push(ne);
        sum += ne;
      } else if (ne < mem.top()) {
        sum = sum - mem.top() + ne;
        mem.pop();
        mem.push(ne);
      }
    }
    if (mem.size() == K) res = min(res, K * B * cur + sum);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> N >> K >> B >> C;
  B = min(B, 5 * C);
  long long small = 1ll << 60;
  for (int i = 0; i < N; ++i) {
    cin >> T[i];
    small = min(small, T[i]);
  }
  if (small < 0)
    for (int i = 0; i < N; ++i) T[i] -= small;
  for (int i = 0; i < 5; ++i) {
    vector<pair<long long, long long> > l;
    for (int j = 0; j < N; ++j) {
      long long tmp = 5 * (T[j] / 5) + i;
      if (tmp < T[j]) tmp += 5;
      l.push_back(pair<long long, long long>(
          (tmp - i) / 5, C * (tmp - T[j]) - B * (tmp - i) / 5));
    }
    sort(l.begin(), l.end(), greater<pair<long long, long long> >());
    solve(l);
  }
  cout << res << '\n';
  return 0;
}
