#include <bits/stdc++.h>
namespace XX {
template <template <typename> class Compare, typename T>
inline T& UP(T& x, const T& y) {
  Compare<T>()(y, x) && (x = y);
  return x;
}
template <typename Compare, typename T>
inline T& UP(T& x, const T& y, Compare comp) {
  comp(y, x) && (x = y);
  return x;
}
template <typename T>
inline T& GT(T& x, const T& y) {
  return UP<std::greater>(x, y);
}
template <typename T>
inline T& LS(T& x, const T& y) {
  return UP<std::less>(x, y);
}
template <typename T>
struct MakeV {
  template <typename... Args>
  MakeV(Args&... args) {
    int dummy[] = {(_ptr.push_back(&args), 0)...};
  }
  T& operator[](int idx) { return *_ptr[idx]; }
  struct It {
    typename std::vector<T*>::iterator it;
    T& operator*() { return **it; }
    void operator++() { ++it; }
    bool operator!=(const It& other) { return it != other.it; }
  };
  It begin() { return {_ptr.begin()}; }
  It end() { return {_ptr.end()}; }
  std::vector<T*> _ptr;
};
template <typename T, typename... Args>
std::array<std::reference_wrapper<T>, sizeof...(Args)> MAKEV(T& arg1,
                                                             Args&... args) {
  return {arg1, args...};
}
struct Range {
  struct It {
    int num, step;
    int operator*() { return num; }
    void operator++() { num += step; }
    bool operator!=(const It& other) { return num != other.num; }
  };
  Range(int ee) : b(0), e(ee) {}
  Range(int bb, int ee) : b(bb), e(ee) {}
  It begin() { return {b, (b < e ? 1 : -1)}; }
  It end() { return {e}; }
  int b, e;
};
}  // namespace XX
template <typename T>
struct ScanfSpecifier {};
template <>
struct ScanfSpecifier<int> {
  static constexpr const char* value = "%d";
};
template <>
struct ScanfSpecifier<double> {
  static constexpr const char* value = "%lf";
};
template <>
struct ScanfSpecifier<float> {
  static constexpr const char* value = "%f";
};
template <>
struct ScanfSpecifier<char> {
  static constexpr const char* value = " %c";
};
template <>
struct ScanfSpecifier<const char*> {
  static constexpr const char* value = "%s";
};
template <>
struct ScanfSpecifier<unsigned long> {
  static constexpr const char* value = "%lu";
};
template <>
struct ScanfSpecifier<long long int> {
  static constexpr const char* value = "%lld";
};
template <typename T>
int RD(T& arg) {
  return std::scanf(ScanfSpecifier<T>::value, &arg);
}
template <int S>
int RD(char (&arg)[S]) {
  return std::scanf("%s", arg);
}
template <>
int RD<char*>(char*& arg) {
  return std::scanf("%s", arg);
}
template <typename T, typename... Args>
int RD(T& arg1, Args&... args) {
  return RD(arg1) + RD(args...);
}
template <typename It>
void RDV(It begin, It end) {
  while (begin != end) RD(*begin++);
}
template <typename C>
void RDV(C& c) {
  RDV(std::begin(c), std::end(c));
}
template <typename... Args>
void WT(Args... args) {
  int alc = 0;
  int dummy[] = {((alc++ ? std::printf(" ") : 0),
                  std::printf(ScanfSpecifier<Args>::value, args), 0)...};
}
template <typename... Args>
void WTL(Args... args) {
  WT(args...);
  std::printf("\n");
}
template <typename It>
void WTV(It begin, It end) {
  int alc = 0;
  while (begin != end) (alc++ ? std::printf(" ") : 0), WT(*begin++);
}
template <typename C>
void WTV(const C& c) {
  WTV(std::begin(c), std::end(c));
}
template <typename It>
void WTVL(It begin, It end) {
  WTV(begin, end);
  std::printf("\n");
}
template <typename C>
void WTVL(const C& c) {
  WTVL(std::begin(c), std::end(c));
}
using XX::GT;
using XX::LS;
using XX::UP;
using RG = XX::Range;
using XX::MAKEV;
using namespace std;
int main() {
  int N, K, B, C;
  RD(N, K, B, C);
  vector<int> ts(N);
  RDV(ts.begin(), ts.end());
  sort(ts.begin(), ts.end());
  long long int ans = -1;
  for (int m : RG(5)) {
    struct Rec {
      long long int x, y;
      bool operator<(const Rec& other) const {
        if (x != other.x)
          return x < other.x;
        else
          return y > other.y;
      }
    };
    multiset<Rec> rec;
    long long int total = 0, total2 = 0;
    for (int i : RG(ts.size())) {
      int d = m - (ts[i] % 5 + 5) % 5;
      if (d < 0) d += 5;
      if (rec.size() == K - 1) {
        long long int tmp = min(((ts[i] + d) * (K - 1ll) - total) * C,
                                ((ts[i] + d) * (K - 1ll) - total) / 5 * B) +
                            total2 + d * C;
        if (ans == -1 || ans > tmp) ans = tmp;
      }
      long long int x = ts[i] + d - d * C / B * 5;
      long long int y = d * C % B;
      total += x;
      total2 += y;
      rec.insert({x, y});
      if (rec.size() > K - 1) {
        total -= rec.begin()->x;
        total2 -= rec.begin()->y;
        rec.erase(rec.begin());
      }
    }
  }
  WTL(ans);
}
