#include <bits/stdc++.h>
using namespace std;
const int N = 200050;
const long long inf = 1e18;
long long min(long long a, long long b) { return a > b ? b : a; }
long long t[N], u[N], v[N], b, c;
long long sol = inf;
multiset<long long> val;
void Solve(long long n, long long k) {
  long long sum = 0, i;
  val.clear();
  for (i = 1; i <= k; i++) {
    sum += (long long)(u[k] - u[i]) * b / 5 + v[i];
    val.insert((long long)(u[k] - u[i]) * b / 5 + v[i]);
  }
  long long lzy = 0, fir = u[k];
  for (i = k; i <= n; i++) {
    lzy = u[i] - fir;
    sol = min(sol, sum + lzy * k * b / 5);
    if (i != n) {
      lzy = u[i + 1] - fir;
      sum += (long long)v[i + 1] - lzy * b / 5;
      val.insert((long long)v[i + 1] - lzy * b / 5);
      long long del = *val.rbegin();
      sum -= del;
      val.erase(--val.end());
    }
  }
}
long long mod(long long x) { return (x % 5 + 5) % 5; }
int main() {
  long long n, k, i, j;
  scanf("%lld %lld %lld %lld", &n, &k, &b, &c);
  b = min(b, c * 5);
  for (i = 1; i <= n; i++) scanf("%lld", &t[i]);
  sort(t + 1, t + 1 + n);
  for (j = 0; j < 5; j++) {
    for (i = 1; i <= n; i++) {
      if (mod(t[i]) <= j)
        u[i] = t[i] + j - mod(t[i]), v[i] = (j - mod(t[i])) * c;
      else
        u[i] = t[i] + j - mod(t[i]) + 5, v[i] = (j - mod(t[i]) + 5) * c;
    }
    Solve(n, k);
  }
  printf("%lld\n", sol);
  return 0;
}
