#include <bits/stdc++.h>
using namespace std;
void pass() { return; }
const double EPS = 1e-6;
mt19937 rnd(rand() << 15 + rand());
const long long MOD = 1e9 + 7;
const long long BIG_MOD = 1e18 + 7;
const long long MAXN = 1e6 + 7;
const long long MAXV = 2e6 + 7;
long long a[MAXN];
long long kolvo[MAXV], sum[MAXV];
long long counter[MAXV];
signed main() {
  cout.tie(NULL);
  cout.precision(20);
  ios_base::sync_with_stdio(false);
  long long n, x, y;
  cin >> n >> x >> y;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    counter[a[i]]++;
  }
  for (long long i = 1; i < MAXV; ++i) {
    kolvo[i] = kolvo[i - 1] + counter[i];
    sum[i] = sum[i - 1] + counter[i] * i;
  }
  long long ans = 1e18 + 7;
  for (long long div = 2; div < MAXV; ++div) {
    if (div > 2 && !(div % 2)) continue;
    if (div > 3 && !(div % 3)) continue;
    long long new_ans = 0;
    long long l = 0;
    long long r = div;
    while (l < r - 1) {
      long long m = (l + r) / 2;
      if ((div - m) * y < x) {
        r = m;
      } else {
        l = m;
      }
    }
    long long left = 1;
    for (long long left = 1; left + div - 1 < MAXV; left += div) {
      long long right = left + div - 1;
      long long last_x = left + l - 1;
      long long klv1 = kolvo[last_x] - kolvo[left - 1];
      long long klv2 = kolvo[right] - kolvo[last_x];
      new_ans += x * klv1 + y * ((right * klv2) - (sum[right] - sum[last_x]));
    }
    ans = min(ans, new_ans);
  }
  cout << ans << '\n';
  return 0;
}
