#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7, siz = 2e6 + 5;
long long t, n, x, y, m, k, a[siz], cnt[siz], sum[siz];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> x >> y;
  for (long long i = 0; i < n; i++) {
    long long inp;
    cin >> inp;
    cnt[inp]++;
    sum[inp] += inp;
  }
  for (long long i = 1; i < siz; i++) {
    cnt[i] += cnt[i - 1];
    sum[i] += sum[i - 1];
  }
  long long ans = 1e18;
  for (long long gcd = 2; gcd < siz; gcd++) {
    long long cur = 0;
    long long bck = min(gcd - 1, x / y);
    for (long long j = gcd; j < siz; j += gcd) {
      long long need =
          1LL * j * (cnt[j] - cnt[j - bck - 1]) - (sum[j] - sum[j - bck - 1]);
      cur += need * y;
      cur += 1LL * x * (cnt[j - bck - 1] - cnt[j - gcd]);
    }
    ans = min(ans, cur);
  }
  cout << ans << endl;
}
