#include <bits/stdc++.h>
using namespace std;
const int MA = 1000000;
const int SZ = 2000010;
long long sum[SZ];
long long num[SZ];
long long T[500010];
bool sieve[1000010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, x, y;
  cin >> n >> x >> y;
  for (int i = 0; i < n; i++) cin >> T[i];
  memset(sieve, 0, sizeof(sieve));
  for (int i = 2; i <= MA; i++) {
    if (sieve[i] == 0) {
      for (int j = i * 2; j <= MA; j += i) sieve[j] = 1;
    }
  }
  bool one = 1;
  for (int i = 0; i < n; i++) {
    if (T[i] != 1) one = 0;
  }
  if (one) {
    cout << min(x, y) * n << endl;
    return 0;
  }
  memset(num, 0, sizeof(num));
  memset(sum, 0, sizeof(sum));
  for (int i = 0; i < n; i++) {
    num[T[i]]++;
    sum[T[i]] += T[i];
  }
  for (int i = 1; i <= 2 * MA; i++) {
    num[i] += num[i - 1];
    sum[i] += sum[i - 1];
  }
  long long v = x * (n - 1);
  long long z = x / y;
  for (int i = 2; i <= MA; i++) {
    if (sieve[i]) continue;
    int k = min(z, (i - 1) * 1LL);
    long long X = 0, Y = 0;
    for (int j = 1; (j - 1) * i <= MA; j++) {
      X += (num[j * i - k - 1] - num[(j - 1) * i]);
      Y += ((num[j * i] - num[j * i - k - 1]) * (j * i) -
            (sum[j * i] - sum[j * i - k - 1]));
    }
    if (v / y < Y) continue;
    if (v / x < X) continue;
    v = min(v, x * X + y * Y);
  }
  cout << v << endl;
  return 0;
}
