#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  T ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T, class X>
inline bool getbit(T a, X i) {
  T t = 1;
  return ((a & (t << i)) > 0);
}
template <class T, class X>
inline T setbit(T a, X i) {
  T t = 1;
  return (a | (t << i));
}
template <class T, class X>
inline T resetbit(T a, X i) {
  T t = 1;
  return (a & (~(t << i)));
}
bool iscomp[1000009];
vector<long long> plist;
void sieve() {
  for (int i = 2; i * i <= 1000007; i++) {
    if (iscomp[i]) continue;
    for (int j = i; i * j <= 1000007; j++) iscomp[i * j] = 1;
  }
  for (int i = (2); i <= (1000007); i++) {
    if (!iscomp[i]) plist.push_back(i);
  }
}
long long n, x, y, arr[500009], sum[2000109], cnt[2000109];
int main() {
  sieve();
  scanf("%lld %lld %lld", &n, &x, &y);
  for (int i = (1); i <= (n); i++) scanf("%lld", &arr[i]);
  sort(arr + 1, arr + n + 1);
  long long d = x / y;
  long long ans = (1LL << 62) - 1, nowval, dist, tmp;
  for (int i = (1); i <= (n); i++) cnt[arr[i]]++;
  for (long long i = (1); i <= (2000100); i++) {
    sum[i] = sum[i - 1] + cnt[i] * i;
  }
  for (int i = (1); i <= (2000100); i++) cnt[i] += cnt[i - 1];
  long long nc, st;
  for (int i = (0); i <= (plist.size() - 1); i++) {
    nc = 0;
    nowval = 0;
    while (nc <= arr[n]) {
      nc += plist[i];
      st = nc - plist[i] + 1;
      dist = nc - d;
      if (dist < st) dist = st;
      nowval += (cnt[dist - 1] - cnt[st - 1]) * x;
      nowval +=
          y * (((cnt[nc] - cnt[dist - 1]) * nc) - (sum[nc] - sum[dist - 1]));
    }
    if (nowval < ans) ans = nowval;
  }
  printf("%lld\n", ans);
  return 0;
}
