#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const long long inf = 0x3f3f3f3f3f3f3f3f;
int n, k, b, c;
int a[N], A[N], cost[N];
long long ans = inf;
void solve(int x) {
  for (int i = 1; i <= n; ++i) {
    A[i] = a[i];
    cost[i] = 0;
    while (A[i] % 5 != x) ++A[i], cost[i] += c;
  }
  priority_queue<long long> heap;
  long long res = 0;
  for (int i = 1; i <= k; ++i) {
    long long val = 5 * cost[i] - 1LL * b * A[i];
    res += val;
    heap.push(val);
  }
  ans = min(ans, (res + 1LL * k * b * A[k]) / 5);
  for (int i = k + 1; i <= n; ++i) {
    long long val = 5 * cost[i] - 1LL * b * A[i];
    if (val < heap.top()) {
      res -= heap.top();
      heap.pop();
      heap.push(val);
      res += val;
    }
    ans = min(ans, (res + 1LL * k * b * A[i]) / 5);
  }
}
int main() {
  cin >> n >> k >> b >> c;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    a[i] += 1e9;
  }
  sort(a + 1, a + n + 1);
  b = min(b, c * 5);
  for (int i = 0; i < 5; ++i) solve(i);
  cout << ans << endl;
  return 0;
}
