#include <bits/stdc++.h>
using namespace std;
long long ara[200000];
int main() {
  long long i, j;
  long long n, k, b, c;
  scanf("%lld %lld %lld %lld", &n, &k, &b, &c);
  b = min(b, 5 * c);
  for (i = 0; i < n; i++) scanf("%lld", &ara[i]);
  sort(ara, ara + n);
  long long res = 1e18;
  for (i = 0; i < 5; i++) {
    multiset<long long, greater<long long>> umod;
    long long tim = 0, add = 0, prev;
    for (j = 0; j < n; j++) {
      for (long long k = 0; k < 5; k++) {
        if (((ara[j] + k) % 5 + 5) % 5 == i) {
          if (j) {
            add += ((ara[j] + k - prev) * b) / 5;
            tim += (long long)umod.size() * ((ara[j] + k - prev) * b) / 5;
          }
          umod.insert(k * c - add);
          tim += k * c;
          prev = ara[j] + k;
          break;
        }
      }
      if ((long long)umod.size() > k) {
        tim -= *(umod.begin()) + add;
        umod.erase(umod.begin());
      }
      if ((long long)umod.size() == k) res = min(res, tim);
    }
  }
  printf("%lld", res);
}
