#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const int MAX = 1e3 + 5;
const int MAXN = 1000000;
const int MAX_N = MAX;
const long long MOD = 1e9 + 7;
const long double pi = acos(-1.0);
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <class T>
inline void read(T& num) {
  bool start = false, neg = false;
  char c;
  num = 0;
  while ((c = getchar()) != EOF) {
    if (c == '-')
      start = neg = true;
    else if (c >= '0' && c <= '9') {
      start = true;
      num = num * 10 + c - '0';
    } else if (start)
      break;
  }
  if (neg) num = -num;
}
inline long long powMM(long long a, long long b, long long M) {
  long long ret = 1;
  a %= M;
  while (b) {
    if (b & 1) ret = ret * a % M;
    b >>= 1;
    a = a * a % M;
  }
  return ret;
}
void open() {
  freopen("1009.in", "r", stdin);
  freopen("out.txt", "w", stdout);
}
int prime[MAXN + 1];
void getPrime(int w) {
  memset(prime, 0, sizeof(prime));
  for (int i = 2; i <= w; i++) {
    if (!prime[i]) prime[++prime[0]] = i;
    for (int j = 1; j <= prime[0] && prime[j] <= w / i; j++) {
      prime[prime[j] * i] = 1;
      if (i % prime[j] == 0) break;
    }
  }
}
int tem;
long long num[MAXN + 10];
long long sum[MAXN + 10];
long long n, x, y, an, da, bor, t_an;
long long cnt(int l, int r) {
  if (r > da) r = da;
  if (l > da || l > r) return 0LL;
  return num[r] - num[l - 1];
}
long long val(int l, int r) {
  if (r > da) r = da;
  if (l > da || l > r) return 0LL;
  return sum[r] - sum[l - 1];
}
int main() {
  scanf("%I64d%I64d%I64d", &n, &x, &y);
  an = n * x;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &tem);
    da = max(da, 1LL * tem);
    num[tem]++;
    sum[tem] += tem;
  }
  if (da == 1) ++da;
  getPrime(da);
  for (int i = 1; i <= da; i++) sum[i] += sum[i - 1], num[i] += num[i - 1];
  int p = (x + y - 1) / y;
  for (long long s = 1; prime[s] <= da && s <= prime[0]; s++) {
    long long i = prime[s], j;
    t_an = 0;
    for (j = i; j <= da + i - 1 && t_an < an; j += i) {
      bor = max(j - i, j - p);
      t_an += cnt(j - i + 1, bor) * x;
      t_an += (cnt(bor + 1, j) * j - val(bor + 1, j)) * y;
    }
    an = min(an, t_an);
  }
  printf("%I64d\n", an);
}
