#include <bits/stdc++.h>
int const N = 200200;
int const INF = 1e9 + 100;
long long const INFL = 1e18;
int const FIVE = 5;
int t[N];
int main() {
  int n, k, b, c;
  scanf("%d%d%d%d", &n, &k, &b, &c);
  b = std::min(b, FIVE * c);
  for (int i = 0; i < n; ++i) {
    scanf("%d", t + i);
  }
  std::sort(t, t + n);
  long long ans = INFL;
  for (int rem = 0; rem < FIVE; ++rem) {
    long long const BIG = INF + rem;
    std::multiset<long long> values;
    long long sum = 0;
    for (int i = 0; i < n; ++i) {
      long long cur = (BIG - t[i]) / FIVE * b + (BIG - t[i]) % FIVE * c;
      values.insert(-cur);
      sum += cur;
      if ((int)values.size() > k) {
        sum += *values.begin();
        values.erase(values.begin());
      }
      if ((int)values.size() == k) {
        ans = std::min(ans, sum - (BIG - t[i]) / FIVE * b * k);
      }
    }
  }
  printf("%I64d\n", ans);
}
