#include <bits/stdc++.h>
using namespace std;
long long arr[200000];
long long toAdd[200000];
long long tmp[200000];
multiset<long long> ms;
long long n, k, b, c;
int main() {
  cin >> n >> k >> b >> c;
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  if (arr[0] < 0) {
    long long h = (-arr[0]) / 5;
    h++;
    for (int i = 0; i < n; i++) arr[i] += h * 5;
  }
  b = min(b, 5 * c);
  long long ans = 2000000000000000000LL;
  for (long long mod = 0; mod < 5; mod++) {
    long long curAns = 0;
    for (int i = 0; i < n; i++) {
      long long curMod = arr[i] % 5;
      toAdd[i] = (mod + 5 - curMod) % 5;
      tmp[i] = arr[i] + toAdd[i];
    }
    long long allSum = 0;
    for (int i = 0; i < k; i++) {
      curAns += toAdd[i] * c;
      curAns += (tmp[k - 1] - tmp[i]) / 5 * b;
      ms.insert(toAdd[i] * c + (tmp[k - 1] - tmp[i]) / 5 * b);
    }
    allSum = curAns;
    ans = min(ans, curAns);
    for (long long i = k; i < n; i++) {
      long long maxi = *(ms.rbegin());
      long long diff = (tmp[i] - tmp[k - 1]) / 5;
      if (maxi + diff * b > toAdd[i] * c) {
        ms.erase(ms.find(maxi));
        ms.insert(toAdd[i] * c - diff * b);
        allSum -= maxi;
        allSum += toAdd[i] * c - diff * b;
        curAns = allSum + diff * k * b;
      } else
        curAns = allSum + diff * k * b;
      ans = min(ans, curAns);
    }
    ans = min(ans, curAns);
    ms.clear();
  }
  cout << ans << endl;
  return 0;
}
