#include <bits/stdc++.h>
using namespace std;
long long a[200500];
int b, c;
long long delta[10];
long long z[10];
long long s[10];
priority_queue<pair<long long, int> > q[10];
long long dist(long long x) { return (x / 5) * b + (x % 5) * c; }
int main() {
  int n, k;
  scanf("%d%d%d%d", &n, &k, &b, &c);
  if (b > 5 * c) b = 5 * c;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    a[i] = x;
  }
  long long zzz_ = a[0];
  for (int i = 0; i < n; i++)
    if (a[i] < zzz_) zzz_ = a[i];
  for (int i = 0; i < n; i++) a[i] -= zzz_;
  sort(a, a + n);
  for (int i = 0; i < 5; i++) z[(a[k - 1] + i) % 5] = a[k - 1] + i;
  for (int i = 0; i < 5; i++) delta[i] = 0;
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < k; j++) {
      long long t = dist(z[i] - a[j]);
      q[i].push(make_pair(t, j));
      s[i] += t;
    }
  long long res = s[0];
  for (int i = 1; i < 5; i++)
    if (s[i] < res) res = s[i];
  for (int i = k; i < n; i++)
    for (int j = 0; j < 5; j++) {
      if (z[j] < a[i]) {
        long long l = a[i] - z[j] + 4;
        l /= 5;
        z[j] += 5 * l;
        delta[j] += l * b;
        s[j] += l * k * b;
      }
      long long t = dist(z[j] - a[i]);
      s[j] += t;
      q[j].push(make_pair(t - delta[j], i));
      long long dd = q[j].top().first;
      s[j] -= dd + delta[j];
      q[j].pop();
      if (s[j] < res) res = s[j];
    }
  cout << res << endl;
  return 0;
}
