#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using ld = long double;
const int mxn = 2000006;
const ll MXL = 1E18;
ll cx, cy;
ll c[mxn];
ll s[mxn];
ll l[mxn];
ll count(ll *a, int l, int r) { return a[r] - a[l - 1]; }
ll solve(ll len) {
  ll yl = min(len - 1, cx / cy);
  ll x = 0, y = 0;
  ll mn = MXL;
  for (ll i = len; i <= 2000000; i += len) {
    x += count(c, i - len + 1, i - yl - 1);
    y += count(c, i - yl, i) * i - count(s, i - yl, i);
    if (l[i]) mn = min(mn, i - l[i]);
  }
  if (ld(cx) * x + ld(cy) * y > MXL) return MXL;
  return cx * x + cy * y;
}
int main() {
  ll n;
  cin >> n >> cx >> cy;
  for (int i = 0; i < n; ++i) {
    ll x;
    scanf("%lld", &x);
    ++c[x];
    s[x] += x;
    l[x] = x;
  }
  partial_sum(c, end(c), c);
  partial_sum(s, end(s), s);
  for (int i = 1; i < mxn; ++i)
    if (c[i] == 0) c[i] = c[i - 1];
  ll ans = MXL;
  for (int i = 2; i <= 1000000; ++i) ans = min(ans, solve(i));
  cout << ans << endl;
  return 0;
}
