#include <bits/stdc++.h>
using namespace std;
template <class T>
T inline sqr(T x) {
  return x * x;
}
const long double pi = 3.1415926535897932384626433832795;
const long double eps = 1e-8;
const long long inf = 1e18;
int ptr[5];
vector<int> els[5];
long long sum = 0;
int n;
int k;
long long b;
long long c;
long long calc(long long x) { return x * k * b + 4 * c * k - sum; }
long long vals[5];
long long solve(const vector<int>& t) {
  long long res = inf;
  if (b >= 5 * c) {
    long long s = 0;
    for (int i = 0; i < (int)(k - 1); ++i) s += t[i];
    for (int i = k - 1; i < n; i++) {
      res = min(res, t[i] * (k - 1LL) - s);
      s -= t[i - (k - 1)];
      s += t[i];
    }
    return res;
  }
  for (int i = 0; i < (int)(5); ++i) els[i].clear(), ptr[i] = 0;
  for (int i = 0; i < (int)(k); ++i) {
    els[t[i] % 5].push_back(t[i] / 5);
  }
  sum = 0;
  for (int i = 0; i < (int)(5); ++i) {
    sum += els[i].size() * c * i;
    for (int x : els[i]) sum += b * x;
  }
  res = calc(t[k - 1] / 5);
  for (int i = k; i < n; i++) {
    els[t[i] % 5].push_back(t[i] / 5);
    sum += (t[i] % 5) * c;
    sum += b * (t[i] / 5);
    for (int j = 0; j < (int)(5); ++j)
      if (ptr[j] >= (int)els[j].size())
        vals[j] = inf;
      else
        vals[j] = j * c + b * els[j][ptr[j]];
    int ind = min_element(vals, vals + 5) - vals;
    sum -= vals[ind];
    ptr[ind]++;
    res = min(res, calc(t[i] / 5));
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k >> b >> c;
  vector<int> t(n);
  for (int i = 0; i < (int)(n); ++i) cin >> t[i];
  sort((t).begin(), (t).end());
  int mn = t[0];
  for (int i = 0; i < (int)(n); ++i) t[i] -= mn;
  long long ans = inf;
  for (int it = 0; it < (int)(5); ++it) {
    ans = min(ans, solve(t));
    for (int i = 0; i < (int)(n); ++i) t[i]++;
  }
  cout << ans << endl;
  return 0;
}
