#include <bits/stdc++.h>
using namespace std;
const int maxn = 200110;
long long t[maxn];
int n, k, b, c;
int main() {
  scanf("%d%d%d%d", &n, &k, &b, &c);
  b = min(c * 5, b);
  for (int i = 0; i < n; ++i) {
    scanf("%I64d", &t[i]), t[i] += 1e9;
  }
  sort(t, t + n);
  int lx;
  long long sum = 0;
  long long ans = 1e18;
  for (int ed = 0; ed < 5; ++ed) {
    sum = 0;
    priority_queue<long long, vector<long long>, greater<long long> > que;
    while (!que.empty()) que.pop();
    for (int i = 0; i < n; ++i) {
      lx = (ed + 5 - t[i] % 5) % 5;
      long long num = (t[i] + lx) / 5 * b - lx * c;
      que.push(num);
      sum += num;
      if (i >= k - 1) {
        ans = min(ans, (t[i] + lx) / 5 * b * k - sum);
        sum -= que.top();
        que.pop();
      }
    }
  }
  printf("%I64d\n", ans);
}
