#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
const long long maxn = (long long)2e5 + 5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max() - 1;
long long dx[] = {0, 1, 0, -1};
long long dy[] = {1, 0, -1, 0};
long long dxx[] = {0, 1, 0, -1, 1, 1, -1, -1};
long long dyy[] = {1, 0, -1, 0, 1, -1, 1, -1};
struct node {
  long long cost, val;
};
vector<node> v[5];
long long n, k, B, C;
bool comp(node a, node b) {
  if (a.val > b.val) {
    long long p1 = a.cost;
    long long p2 = b.cost + ((a.val - b.val) / 5) * B;
    return p1 < p2;
  }
  long long p1 = a.cost + ((b.val - a.val) / 5) * B;
  long long p2 = b.cost;
  return p1 < p2;
}
bool comp2(node a, node b) { return a.val < b.val; }
long long a[maxn];
void solve() {
  cin >> n >> k >> B >> C;
  for (int i = 1; i <= (n); i++) cin >> a[i], a[i] += 1e9 + 100;
  B = min(B, 5 * C);
  sort(a + 1, a + n + 1);
  long long ans = 1e18;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j < 5; j++) {
      v[(a[i] + j) % 5].push_back({j * C, a[i] + j});
    }
  }
  for (int i = 0; i < (5); i++) sort(v[i].begin(), v[i].end(), comp2);
  for (long long j = 0; j < 5; j++) {
    multiset<node, decltype(comp)*> s(comp);
    map<pair<long long, long long>, long long> mp;
    s.clear();
    long long sum = 0;
    long long w = 0;
    for (long long i = 0; i < k; i++) {
      s.insert(v[j][i]);
      w += v[j][i].val;
      sum += v[j][i].cost;
    }
    ans = min(ans, sum + ((v[j][k - 1].val * k - w) / 5) * B);
    for (long long i = k; i < n; i++) {
      node g = *s.rbegin();
      assert(s.size() == k);
      if (comp(v[j][i], g)) {
        s.erase(s.find(g));
        sum -= g.cost;
        w -= g.val;
        s.insert(v[j][i]);
        w += v[j][i].val;
        sum += v[j][i].cost;
      }
      ans = min(ans, sum + (((v[j][i].val * k) - w) / 5) * B);
    }
  }
  cout << ans;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T;
  T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
