#include <bits/stdc++.h>
using namespace std;
const int N = 2E5 + 10;
int n, k, b, c, a[N];
long long ans = 1000000000000000000ll;
multiset<long long> S;
int main() {
  scanf("%d%d%d%d", &n, &k, &b, &c);
  if (b > 5 * c) b = 5 * c;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + 1 + n);
  for (int i = 0; i < 5; i++) {
    long long res = 0;
    S.clear();
    for (int j = 1; j <= n; j++) {
      int t = a[j], cos = 0;
      while ((t % 5 + 5) % 5 != i) t++, cos += c;
      S.insert(1ll * cos - 1ll * b * (t - i) / 5);
      res += 1ll * cos - 1ll * b * (t - i) / 5;
      if (S.size() > k) res -= (*S.rbegin()), S.erase(S.find(*S.rbegin()));
      if (S.size() == k) ans = min(ans, res + 1ll * k * b * (t - i) / 5);
    }
  }
  printf("%lld", ans);
  return 0;
}
