#include <bits/stdc++.h>
using namespace std;
const int A = 1e7 + 10;
const int B = 1e6 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
  return x * f;
}
struct node {
  long long val;
  int add_tag;
};
node arr[200010];
bool cmp(const node& a, const node& b) {
  return a.val + a.add_tag < b.val + b.add_tag;
}
int main() {
  int n, k;
  long long b, c;
  cin >> n >> k >> b >> c;
  b = min(b, 5 * c);
  for (int i = 1; i <= n; ++i) {
    cin >> arr[i].val;
    arr[i].val += 1e9;
  }
  long long res = 4e17;
  for (int r = 0; r <= 4; ++r) {
    for (int i = 1; i <= n; ++i) {
      int j = 0;
      while ((arr[i].val + j) % 5 != r) j++;
      arr[i].add_tag = j;
    }
    sort(arr + 1, arr + n + 1, cmp);
    priority_queue<long long> pq;
    long long sum = 0;
    for (int i = 1; i <= n; ++i) {
      long long aim = arr[i].val + arr[i].add_tag;
      long long temp =
          c * arr[i].add_tag - b * (arr[i].val + arr[i].add_tag - r) / 5;
      sum += temp;
      pq.push(temp);
      if (pq.size() == k) {
        res = min(res, sum + b * (aim - r) / 5 * k);
        sum -= pq.top();
        pq.pop();
      }
    }
  }
  cout << res << endl;
  return 0;
}
