#include <bits/stdc++.h>
using namespace std;
long long a[200005];
int main() {
  int n;
  long long k, b, c;
  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 = 1e18;
  if (c * 5 <= b) {
    for (int i = 0; i < n; i++) {
      sum += a[i];
      if (i >= k) sum -= a[i - k];
      if (i >= k - 1) ans = min(ans, a[i] * k - sum);
    }
    ans = ans * c;
    cout << ans << endl;
  } else {
    for (int mp = 0; mp < 5; mp++) {
      sum = 0;
      priority_queue<long long> que;
      for (int i = 0; i < n; i++) {
        long long cc = (mp + 5 - a[i] % 5) % 5;
        long long bb = (a[i] + cc) / 5;
        long long cost = cc * c - bb * b;
        que.push(cost);
        sum += cost;
        if (i >= k - 1) {
          if (i >= k) {
            sum -= que.top();
            que.pop();
          }
          ans = min(ans, sum + k * bb * b);
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
