#include <bits/stdc++.h>
using namespace std;
const long long md = 1e9 + 7;
int main() {
  cout.precision(12);
  iostream::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  const int MX = 1e6 + 1;
  vector<int> pr(MX, 1);
  vector<int> o;
  for (int i = 2; i < MX; i++) {
    if (!pr[i]) continue;
    o.push_back(i);
    for (long long j = i * 1ll * i; j < MX; j += i) pr[j] = 0;
  }
  long long n, x, y;
  cin >> n >> x >> y;
  unordered_map<long long, long long> q;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    long long c = a[i];
    for (int j : o) {
      if (j * 1ll * j > a[i]) break;
      if (a[i] % j) continue;
      while (a[i] % j == 0) a[i] /= j;
      q[j]++;
    }
    if (a[i] != 1) q[a[i]]++;
    a[i] = c;
  }
  long long mx = 0;
  for (auto i : q) mx = max(mx, i.second);
  if (x <= y) {
    cout << (n - mx) * x << '\n';
    return 0;
  }
  long long ans = (n - q[2]) * y;
  for (auto i : q) {
    if (i.second <= q[2]) continue;
    long long res = 0;
    bool ch = 1;
    for (long long e : a) {
      long long d = (i.first - (e % i.first)) % i.first;
      res += min(x, y * d);
      if (res > ans) {
        ch = 0;
        break;
      }
    }
    if (ch) ans = min(ans, res);
  }
  cout << ans;
  return 0;
}
