#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int n, k;
long long b, c, a[maxn];
vector<long long> v[5];
queue<long long> Q[5];
long long cal(long long x, long long y) {
  return (y - x) / 5 * b + (y - x) % 5 * c;
}
int main() {
  scanf("%d%d%lld%lld", &n, &k, &b, &c);
  b = min(b, 5 * c);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    a[i] = a[i] + 1e9 + 1;
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < 5; j++) v[(a[i] + j) % 5].push_back(a[i] + j);
  for (int i = 0; i < 5; i++) {
    sort(v[i].begin(), v[i].end());
    v[i].erase(unique(v[i].begin(), v[i].end()), v[i].end());
  }
  long long ans = 1e18;
  for (int p = 0; p < 5; p++) {
    for (int i = 0; i < 5; i++)
      while (!Q[i].empty()) Q[i].pop();
    long long tmp = 0;
    int num = 0;
    for (int i = 0; i < v[p].size(); i++) {
      if (i) tmp = tmp + min(num, k) * (v[p][i] - v[p][i - 1]) / 5 * b;
      while (num < n && a[num + 1] <= v[p][i]) {
        num++;
        Q[a[num] % 5].push(a[num]);
        tmp += cal(a[num], v[p][i]);
        if (num > k) {
          long long s = 0;
          for (int j = 0; j < 5; j++) {
            if (Q[j].size()) {
              int now = Q[j].front();
              s = max(s, cal(now, v[p][i]));
            }
          }
          for (int j = 0; j < 5; j++) {
            if (Q[j].size()) {
              int now = Q[j].front();
              if (cal(now, v[p][i]) == s) {
                Q[j].pop();
                tmp -= s;
                break;
              }
            }
          }
        }
        if (num >= k) ans = min(ans, tmp);
      }
    }
  }
  cout << ans << endl;
}
