#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e6 + 10;
const int mod = 1000000007;
int prime[maxn];
int cnt[maxn];
long long sum[maxn];
void init() {
  memset(prime, 0, sizeof(prime));
  for (int i = 2; i < maxn; i++) {
    if (!prime[i]) prime[++prime[0]] = i;
    for (int j = 1; j < prime[0] && prime[j] < maxn / i; j++) {
      prime[prime[j] * i] = 1;
      if (i % prime[j] == 0) break;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  init();
  int n, x, y, hh, rate;
  cin >> n >> x >> y;
  rate = x / y;
  for (int i = 1; i <= n; i++) {
    cin >> hh;
    cnt[hh]++;
    sum[hh] += 1LL * hh;
  }
  for (int i = 1; i < maxn; i++) {
    cnt[i] += cnt[i - 1];
    sum[i] += sum[i - 1];
  }
  long long ans = INF;
  for (int i = 1; i < prime[0]; i++) {
    long long temp = 0;
    for (int j = 0; (j + 1) * prime[i] <= 1000000 + prime[i]; j++) {
      int limit = max((j + 1) * prime[i] - rate - 1, j * prime[i]);
      int cnt1 = cnt[limit] - cnt[j * prime[i]];
      int cnt2 = cnt[(j + 1) * prime[i]] - cnt[limit];
      long long sum2 = sum[(j + 1) * prime[i]] - sum[limit];
      temp += 1LL * cnt1 * x;
      temp += (1LL * cnt2 * (j + 1) * prime[i] - sum2) * y;
      if (temp > ans) break;
    }
    ans = min(ans, temp);
  }
  cout << ans << endl;
  return 0;
}
