#include <bits/stdc++.h>
using namespace std;
long long cur[5], last[5], ans = 1000000000000000000, b, c;
queue<int> track[5][5];
int n, k, users[200000];
long long query(int x, int y) {
  long long v = (long long)(y - x);
  return (v / 5) * b + (v % 5) * c;
}
void add(int x, int i) {
  int y = x % 5, y1 = users[i] % 5;
  if (y < 0) y += 5;
  if (y1 < 0) y1 += 5;
  cur[y] += (long long)min(i, k) * b * ((x - last[y]) / 5);
  if (i >= k) {
    long long max1 = -1, max2 = -1;
    for (int z = 0; z < 5; z++) {
      if (track[y][z].size() > 0) {
        long long w = query(track[y][z].front(), x);
        if (w > max1) max1 = w, max2 = z;
      }
    }
    cur[y] -= max1;
    track[y][max2].pop();
  }
  track[y][y1].push(users[i]);
  cur[y] += query(users[i], x), last[y] = x;
  if (i >= (k - 1)) ans = min(cur[y], ans);
}
int main() {
  cin >> n >> k >> b >> c;
  b = min(b, 5 * c);
  for (int i = 0; i < n; i++) scanf("%d", &users[i]);
  sort(users, users + n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 5; j++) add(users[i] + j, i);
  cout << ans;
  return 0;
}
