#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const int MAXM = 1000005;
const int MOD = 1000000007;
const int MAMOD = 998244353;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double EPS = 1e-8;
long long n, k, b, c;
long long t[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> k >> b >> c;
  for (int i = 1; i <= n; ++i) {
    cin >> t[i];
    t[i] += 1000000000;
  }
  sort(t + 1, t + 1 + n);
  long long ret = LLINF;
  b = min(b, 5 * c);
  for (int i = 0; i < 5; ++i) {
    priority_queue<long long, vector<long long>, greater<long long>> pq;
    long long x, y, z, sum = 0;
    for (int j = 1; j <= n; ++j) {
      x = (i - t[j] % 5 + 5) % 5;
      y = (t[j] + x) / 5;
      z = y * b - x * c;
      sum += z;
      pq.push(z);
      if (j >= k) {
        ret = min(ret, y * k * b - sum);
        sum -= pq.top();
        pq.pop();
      }
    }
  }
  cout << ret << "\n";
  return 0;
}
