#include <bits/stdc++.h>
using namespace std;
template <class T>
void test(T a) {
  cout << a << endl;
}
template <class T, class T2>
void test(T a, T2 b) {
  cout << a << " " << b << endl;
}
template <class T, class T2, class T3>
void test(T a, T2 b, T3 c) {
  cout << a << " " << b << " " << c << endl;
}
template <class T, class T2, class T3, class T4>
void test(T a, T2 b, T3 c, T4 d) {
  cout << a << " " << b << " " << c << " " << d << endl;
}
const int N = 2e6 + 10;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-15;
const long long mod = 1000000007;
bool isprime[N];
vector<int> prime;
void getprime() {
  memset(isprime, 1, sizeof(isprime));
  isprime[0] = isprime[1] = 0;
  for (int i = 2; i <= (1e6); i++) {
    if (isprime[i]) prime.push_back(i);
    for (int j = 2 * i; j < 1e5; j += i) {
      isprime[j] = 0;
    }
  }
}
long long C[2][N];
int n;
int a[N];
int mx;
long long sum(int k, int x) {
  long long ret = 0;
  for (; x > 0; x -= (x & -x)) {
    ret += C[k][x];
  }
  return ret;
}
long long sum(int k, int l, int r) {
  if (r > mx) r = mx;
  if (l > r) return 0;
  return sum(k, r) - sum(k, l - 1);
}
void add(int k, int x, int v) {
  for (; x <= mx; x += (x & -x)) {
    C[k][x] += v;
  }
}
void work() {
  int x, y;
  cin >> n >> x >> y;
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  for (int i = 0; i < (n); i++) {
    add(0, a[i], a[i]);
    add(1, a[i], 1);
  }
  long long ans = INF;
  for (int i = 0; i < ((int)prime.size()); i++) {
    int g = prime[i];
    int f = min(x / y, g - 1);
    long long now = 0;
    for (int l = 0, r = g; l <= mx; l += g, r += g) {
      now += x * sum(1, l + 1, r - f - 1);
      now += y * (sum(1, r - f, r - 1) * r - sum(0, r - f, r - 1));
    }
    ans = min(ans, now);
  }
  test(ans);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  getprime();
  work();
}
