#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
priority_queue<long long> q[5];
long long sum[5];
int ar[N], basic[5];
int main() {
  int n, k, i, j;
  long long b, c;
  cin >> n >> k >> b >> c;
  for (i = 0; i < n; ++i) cin >> ar[i];
  sort(ar, ar + n);
  long long ret = 1e18, f = min(b, c * 5);
  int v, u = ar[k - 1];
  for (i = 0; i < 5; ++i) sum[i] = 0;
  for (i = 0; i < 5; ++i) {
    v = ((u + i) % 5 + 5) % 5;
    basic[v] = u + i;
  }
  for (i = 0; i < k; ++i) {
    for (j = 0; j < 5; ++j) {
      v = ((u + j) % 5 + 5) % 5;
      long long t =
          c * (((u + j - ar[i]) % 5 + 5) % 5) + f * ((u + j - ar[i]) / 5);
      q[v].push(t);
      sum[v] += t;
    }
  }
  long long diff, t, temp;
  for (i = 0; i < 5; ++i) ret = min(ret, sum[i]);
  for (i = k; i < n; ++i) {
    u = ar[i];
    for (j = 0; j < 5; ++j) {
      v = ((u + j) % 5 + 5) % 5;
      diff = (-basic[v] + ar[i] + j) / 5;
      t = c * j - f * diff;
      if (q[v].top() > t) {
        temp = sum[v] - q[v].top();
        temp = temp + f * (diff * k) + t;
        ret = min(ret, temp);
        temp = sum[v] - q[v].top() + t;
        sum[v] = temp;
        q[v].pop();
        q[v].push(t);
      }
    }
  }
  cout << ret << endl;
}
