#include <bits/stdc++.h>
using namespace std;
bool compare(long long &l, long long &r) { return l < r; }
const int MAXN = 200005;
int n, k, b, c;
long long t[MAXN];
priority_queue<long long> pq;
void input() {
  cin >> n >> k >> b >> c;
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
  }
  if (b > 5 * c) b = 5 * c;
}
void solve() {
  sort(t, t + n);
  long long bound, cost, bound2;
  long long temp, dis;
  long long res = LLONG_MAX;
  long long base, base_res = 0;
  for (int r = 0; r < 5; ++r) {
    cost = 0;
    bound = t[k - 1] + r - t[k - 1] % 5;
    if (bound < t[k - 1]) bound += 5;
    if (bound >= t[k - 1] + 5) bound -= 5;
    for (int i = 0; i < k; ++i) {
      temp = ((bound - t[i]) % 5) * c + (bound - t[i]) / 5 * b;
      pq.push(temp);
      cost += temp;
    }
    if (cost < res) res = cost;
    base = bound;
    for (int i = k; i < n; ++i) {
      bound2 = t[i] + r - t[i] % 5;
      if (bound2 < t[i]) bound2 += 5;
      if (bound2 >= t[i] + 5) bound2 -= 5;
      temp = ((bound2 - t[i]) % 5) * c - (bound2 - base) / 5 * b;
      if (temp < pq.top()) {
        cost -= pq.top() - temp;
        pq.pop();
        pq.push(temp);
      }
      if (cost + (bound2 - base) / 5 * b * k < res)
        res = cost + (bound2 - base) / 5 * b * k;
    }
    while (!pq.empty()) pq.pop();
  }
  cout << res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  input();
  solve();
  return 0;
}
