#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
const double PI = acos(-1);
int n, k, b, c, t[N];
pair<int, int> a[N];
long long ans = INF;
long long cnt = 0;
priority_queue<pair<long long, int> > que;
long long solve(pair<int, int> *a, long long b, long long c) {
  while (!que.empty()) que.pop();
  cnt = 0;
  long long ans = INF, ret = 0;
  for (int i = 1; i <= k; i++) {
    ret += a[i].second * c;
    ret += (a[i].first - a[i - 1].first) * cnt * b;
    que.push(make_pair(c * a[i].second + (a[1].first - a[i].first) * b, i));
    cnt++;
  }
  ans = min(ans, ret);
  for (int i = k + 1; i <= n; i++) {
    int p = que.top().second;
    que.pop();
    cnt--;
    ret -= a[p].second * c;
    ret -= (a[i - 1].first - a[p].first) * b;
    ret += (a[i].first - a[i - 1].first) * cnt * b;
    ret += a[i].second * c;
    que.push(make_pair(c * a[i].second + (a[1].first - a[i].first) * b, i));
    cnt++;
    ans = min(ans, ret);
  }
  return ans;
}
int main() {
  scanf("%d%d%d%d", &n, &k, &b, &c);
  for (int i = 1; i <= n; i++) scanf("%d", &t[i]), t[i] += 1000000000;
  sort(t + 1, t + 1 + n);
  for (int i = 1; i <= n; i++) a[i].first = t[i], a[i].second = 0;
  ans = min(ans, solve(a, c, 0));
  for (int j = 0; j < 5; j++) {
    for (int i = 1; i <= n; i++) {
      a[i].second = ((j - (t[i] % 5)) + 5) % 5;
      a[i].first = (t[i] + a[i].second) / 5;
    }
    ans = min(ans, solve(a, b, c));
  }
  printf("%lld\n", ans);
  return 0;
}
