#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long n, k, b, c;
  cin >> n >> k >> b >> c;
  b = min(b, 5 * c);
  vector<long long> t(n);
  for (long long i = 0; i < n; i++) {
    cin >> t[i];
    t[i] += (long long)1e9;
  }
  sort(t.begin(), t.end());
  long long ans = 1e18;
  for (long long l = 0; l < 5; l++) {
    for (long long i = 0; i < n; i++) t[i]++;
    long long p = 0;
    long long prev = 0;
    long long sum = 0;
    long long cnt = 0;
    vector<multiset<long long> > s(5);
    while (p < n) {
      long long r = (t[p] + 4) / 5 * 5;
      long long d = (r - prev) / 5;
      for (long long i = 0; i < 5; i++) sum += b * d * s[i].size();
      while (p < n && t[p] <= r) {
        s[t[p] % 5].insert(t[p]);
        long long up = (t[p] + 4) / 5 * 5;
        sum += (r - t[p]) / 5 * b + (up - t[p]) * c;
        p++;
        cnt++;
      }
      if (cnt >= k) {
        while (cnt > k) {
          long long m = -1, mval = -1;
          for (long long i = 0; i < 5; i++) {
            if (!s[i].empty()) {
              long long x = *(s[i].begin());
              long long up = (x + 4) / 5 * 5;
              long long val = (r - x) / 5 * b + (up - x) * c;
              if (val > mval) {
                mval = val;
                m = i;
              }
            }
          }
          sum -= mval;
          s[m].erase(s[m].begin());
          cnt--;
        }
        ans = min(ans, sum);
      }
      prev = r;
    }
  }
  cout << ans;
  return 0;
}
