#include <bits/stdc++.h>
using namespace std;
long long div5(long long x) {
  if (x >= 0)
    return x / 5;
  else
    return -(-x / 5);
}
signed main() {
  long long n, k, b, c;
  scanf("%lld %lld %lld %lld", &n, &k, &b, &c);
  vector<long long> t(n);
  for (long long i = 0; i < n; i++) scanf("%lld", &t[i]);
  b = min(b, 5 * c);
  long long answer = 1e18;
  for (long long rest = 0; rest < 5; rest++) {
    vector<pair<long long, long long>> aCost(n);
    for (long long i = 0; i < n; i++) {
      aCost[i].first = t[i];
      long long delta = ((rest - t[i]) % 5 + 5) % 5;
      aCost[i].first += delta;
      aCost[i].second += delta * c;
    }
    for (long long i = 0; i < n; i++) {
      long long delta = -(aCost[i].first - rest) / 5;
      aCost[i].second += delta * b;
    }
    sort(aCost.begin(), aCost.end());
    multiset<long long> minCosts;
    long long sum = 0;
    for (long long i = 0; i < n; i++) {
      if ((long long)minCosts.size() == k - 1) {
        long long can =
            (aCost[i].first - rest) / 5 * k * b + sum + aCost[i].second;
        answer = min(answer, can);
      }
      minCosts.insert(aCost[i].second);
      sum += aCost[i].second;
      if ((long long)minCosts.size() > k - 1) {
        long long minInSet = *prev(minCosts.end());
        sum -= minInSet;
        minCosts.erase(minCosts.find(minInSet));
      }
    }
  }
  printf("%lld\n", answer);
  return 0;
}
