#include <bits/stdc++.h>
using namespace std;
long long n, a[5 * 100001], bb;
long long cost[1000001];
long long ans, x, y;
int prime[1000001];
vector<pair<int, int>> vec;
long long even(int xx) {
  long long l = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] % xx == 0)
      continue;
    else {
      long long cost = xx - (a[i] % xx);
      cost *= y;
      if (x > cost)
        l += cost;
      else
        l += x;
    }
  }
  return l;
}
void fact(int m) {
  for (int i = 1; i * i <= m; i++) {
    if (m % i == 0) {
      cost[i]++;
      if (m / i != i) cost[m / i]++;
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  for (int i = 2; i <= 1e6; i++) {
    if (!prime[i]) {
      for (long long j = i * 2; j <= 1e6; j += i) prime[j] = true;
    }
  }
  cin >> n >> x >> y;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    fact(a[i]);
  }
  ans = min(even(2), min(even(3), even(5)));
  for (int i = 2; i <= 1e6; i++) {
    if (cost[i] && !prime[i]) vec.push_back(make_pair(cost[i], i));
  }
  sort(vec.rbegin(), vec.rend());
  int siz = vec.size();
  for (int i = 0; i < min(100, siz); i++) ans = min(ans, even(vec[i].second));
  cout << ans << endl;
  return 0;
}
