#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795l;
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
struct Input {
  int n, k, b, c;
  vector<int64_t> t;
  bool read() {
    if (scanf("%d%d%d%d", &n, &k, &b, &c) != 4) return 0;
    t.resize(n);
    for (int i = int(0); i < int(n); ++i) {
      int x;
      scanf("%d", &x);
      t[i] = x;
    }
    return 1;
  }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  int64_t ans;
  void write() { printf("%" PRId64 "\n", ans); }
};
const int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
struct Solution : Data {
  void solve() {
    ans = LINF;
    sort((t).begin(), (t).end());
    int64_t min_t = t[0];
    for (int i = int(0); i < int(n); ++i) {
      t[i] = t[i] - min_t + 5;
    };
    umn(b, 5 * c);
    for (int modulo = int(0); modulo < int(5); ++modulo) {
      vector<int64_t> tmp(n, 0ll), stmp(n + 1, 0ll);
      vector<int64_t> add_time(n, 0ll), sum_time(n + 1, 0ll);
      vector<pair<int, int> > borders(n);
      vector<vector<int64_t> > sums(n);
      for (int i = int(0); i < int(n); ++i) {
        int64_t val = t[i] - modulo;
        int diff = (5 - val % 5) % 5;
        val = (val + diff) / 5;
        tmp[i] = val;
        add_time[i] = diff * c;
      }
      multiset<int64_t> vals;
      int64_t cur_add = 0ll;
      int64_t cur_sum = 0ll;
      for (int i = int(0); i < int(n); ++i) {
        if (i) {
          cur_add += int64_t(b) * (tmp[i] - tmp[i - 1]);
        }
        cur_sum += add_time[i] - cur_add;
        vals.insert(add_time[i] - cur_add);
        if (((int)(vals).size()) > k) {
          auto it = vals.end();
          --it;
          int64_t del_val = *it;
          vals.erase(it);
          cur_sum -= del_val;
        }
        if (((int)(vals).size()) == k) {
          umn(ans, int64_t(k) * cur_add + cur_sum);
        }
      }
    }
  }
  void clear() { *this = Solution(); }
};
Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}
