#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
template <class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P) {
  in >> P.first >> P.second;
  return in;
}
template <class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P) {
  out << "(" << P.first << ", " << P.second << ")";
  return out;
}
template <class T>
istream &operator>>(istream &in, vector<T> &arr) {
  for (auto &x : arr) in >> x;
  return in;
}
template <class T>
ostream &operator<<(ostream &out, const vector<T> &arr) {
  for (auto &x : arr) out << x << ' ';
  cout << "\n";
  return out;
}
template <class T>
istream &operator>>(istream &in, deque<T> &arr) {
  for (auto &x : arr) in >> x;
  return in;
}
template <class T>
ostream &operator<<(ostream &out, const deque<T> &arr) {
  for (auto &x : arr) out << x << ' ';
  cout << "\n";
  return out;
}
mt19937 rnd(time(0));
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  long long b, c;
  cin >> n >> k >> b >> c;
  b = min(b, 5 * c);
  vector<long long> cont(n);
  cin >> cont;
  sort(cont.begin(), cont.end());
  if (cont.front() < 0) {
    long long x = cont.front();
    for (auto &y : cont) y -= x;
  }
  long long res = 9e18;
  for (long long rem = 0; rem < 5; rem++) {
    auto dis = [&](long long x, long long y) {
      return (y - x) / 5 * b + (y - x) % 5 * c;
    };
    vector<deque<long long>> q(5);
    long long time = 0, prev = cont[k - 2];
    while (prev % 5 != rem) prev++;
    for (int i = 0; i + 1 < k; i++) {
      time += dis(cont[i], prev);
      q[cont[i] % 5].push_back(cont[i]);
    }
    for (int i = k - 1; i < n; i++) {
      long long target = cont[i];
      while (target % 5 != rem) target++;
      time += (target - prev) / 5 * (k - 1) * b + dis(cont[i], target);
      q[cont[i] % 5].push_back(cont[i]);
      res = min(res, time);
      int p = -1;
      for (int j = 0; j < 5; j++) {
        if (!q[j].empty() && (p == -1 || dis(q[j].front(), target) >
                                             dis(q[p].front(), target))) {
          p = j;
        }
      }
      time -= dis(q[p].front(), target);
      q[p].pop_front();
      prev = target;
    }
  }
  cout << res;
  return 0;
}
