#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 20;
int n;
long long k, b, c;
long long a[maxn];
const long long INF = 1e17;
int main() {
  cin >> n >> k >> b >> c;
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
    a[i] += 1e9;
  }
  sort(a, a + n);
  long long sum = 0, ans = INF;
  if (5 * c <= b) {
    for (int i = 0; i < n; i++) {
      sum += a[i];
      if (i >= k - 1) {
        long long now = c * (a[i] * k - sum);
        ans = min(ans, now);
        sum -= a[i - k + 1];
      }
    }
    cout << ans << endl;
    return 0;
  }
  for (int mod = 0; mod < 5; mod++) {
    priority_queue<long long> q;
    sum = 0;
    for (int i = 0; i < n; i++) {
      long long upc = (mod - a[i] % 5 + 5) % 5;
      long long upb = (a[i] + upc) / 5;
      long long add = c * upc - b * upb;
      sum += add;
      q.push(add);
      if (i >= k - 1) {
        long long now = k * upb * b + sum;
        ans = min(ans, now);
        sum -= q.top();
        q.pop();
      }
    }
  }
  cout << ans << endl;
  return 0;
}
