#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  void solve(std::istream& in, std::ostream& out) {
    long long n, k, b, c, a, d;
    in >> n >> k >> b >> c;
    b = min(b, 5 * c);
    vector<pair<long long, long long>> x(n);
    for (int i = 0; i < n; i++) {
      in >> a;
      x[i] = make_pair(a, 0);
    }
    for (int i = 0; i < n; i++) {
      for (int j = 1; j < 5; j++) {
        x.push_back(make_pair(x[i].first + j, -j));
      }
    }
    n = x.size();
    vector<vector<pair<long long, long long>>> y(5), z(5);
    for (int i = 0; i < n; i++) {
      a = x[i].first % 5;
      if (a < 0) {
        a = a + 5;
      }
      y[a].push_back(x[i]);
    }
    for (int i = 0; i < 5; i++) {
      sort(begin(y[i]), end(y[i]));
      int t = y[i].size();
      long long h = y[i].back().first;
      z[i] = vector<pair<long long, long long>>(t);
      for (int j = 0; j < t; j++) {
        z[i][j] =
            make_pair(-((h - y[i][j].first) / 5 * b - y[i][j].second * c), j);
      }
      sort(begin(z[i]), end(z[i]));
    }
    long long m = 100000000000000000;
    for (int i = 0; i < 5; i++) {
      int t = y[i].size();
      priority_queue<pair<int, int>> q;
      long long p = 0;
      int l = t - 1, r = t - 1;
      long long h;
      while (l >= 0) {
        if (r < 0) break;
        d = y[i][r].first;
        if (q.size()) {
          a = q.top().first;
          p -= (h - a) / 5 * b * q.size();
          h = a;
        }
        while (q.size() && d < q.top().first) {
          p += q.top().second * c;
          q.pop();
          if (q.size()) {
            a = q.top().first;
            p -= (h - a) / 5 * b * q.size();
            h = a;
          } else
            p = 0;
        }
        if (q.size()) {
          a = q.top().first;
          p += (d - a) / 5 * b * q.size();
        }
        while (l >= 0 && q.size() < k) {
          a = z[i][l].second;
          if (y[i][a].first > d) {
            l--;
            continue;
          }
          p -= y[i][a].second * c;
          p += (d - y[i][a].first) / 5 * b;
          q.push(y[i][a]);
          l--;
        }
        if (q.size() == k) m = min(m, p);
        h = d;
        r--;
        while (r >= 0 && y[i][r].first == y[i][r + 1].first) r--;
      }
    }
    out << m;
  }
};
void solve(std::istream& in, std::ostream& out) {
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  ostream& out = cout;
  solve(in, out);
  return 0;
}
