#include <bits/stdc++.h>
using namespace std;
const long long M = 1e6 + 1, MOD = 1e9 + 7;
int p[M];
vector<long long> vec;
long long dp[M];
long long vis[M];
void solve() {
  for (int i = 1; i < M; i++) p[i] = i;
  for (int i = 2; i * i < M; i++) {
    if (p[i] == i) {
      for (int j = i * i; j < M; j += i)
        if (p[j] == j) p[j] = i;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  long long n, x, y;
  cin >> n >> x >> y;
  vector<long long> v(n + 2);
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    long long temp = v[i];
    while (temp > 1) {
      long long c = p[temp];
      if (vis[c] != i) {
        dp[c]++;
      }
      vis[c] = i;
      temp /= c;
    }
  }
  vector<pair<int, long long>> vec;
  for (int i = 2; i < M; i++) {
    if (dp[i]) vec.push_back({dp[i], i});
  }
  sort(vec.rbegin(), vec.rend());
  if ((int)vec.size() == 0) {
    cout << min(n * x, n * y) << "\n";
    return 0;
  }
  long long res = 1e18;
  for (int i = 0; i < min((int)vec.size(), 100); i++) {
    long long cnt = 0;
    long long id = vec[i].second;
    for (int j = 1; j <= n; j++) {
      if (v[j] % id == 0) continue;
      long long d = v[j] / id;
      d++;
      d *= id;
      d -= v[j];
      cnt += min(d * y, x);
    }
    res = min(res, cnt);
  }
  for (long long i = 2; i <= 100; i++) {
    long long cnt = 0;
    long long id = i;
    for (int j = 1; j <= n; j++) {
      if (v[j] % id == 0) continue;
      long long d = v[j] / id;
      d++;
      d *= id;
      d -= v[j];
      cnt += min(d * y, x);
    }
    res = min(res, cnt);
  }
  cout << res << "\n";
  return 0;
}
