#include <bits/stdc++.h>
using namespace std;
vector<long long int> fact(2000006);
vector<long long int> prime_check(1e7 + 2);
vector<long long int> primes;
long long powmod(long long x, long long y, long long m) {
  long long res = 1LL;
  while (y) {
    if (y & 1) res = (res * x) % m;
    x = (x * x) % m;
    y /= 2;
  }
  return res;
}
void init_fact() {
  fact[0] = 1;
  for (long long int i = 1; i < 2000006; i++) {
    fact[i] = (fact[i - 1] * i) % 1000000007;
  }
}
long long int C(long long int n, long long int r) {
  if (n < r) return 0;
  long long int temp =
      fact[n] * powmod(fact[r], 1000000007 - 2, 1000000007) % 1000000007;
  temp *= powmod(fact[n - r], 1000000007 - 2, 1000000007);
  temp %= 1000000007;
  return temp;
}
void Sieve() {
  for (long long int i = 2; i <= 1e7 + 1; i++) {
    if (prime_check[i]) continue;
    primes.push_back(i);
    for (long long int j = 2 * i; j <= 1e7 + 1; j += i) prime_check[j] = i;
  }
}
long long int phi(long long int n) {
  long long int i, res = n;
  for (i = 2; i * i <= n; i++)
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      res -= res / i;
    }
  if (n > 1) res -= res / n;
  return res;
}
long long int n, x, y;
vector<long long int> a(2000006), b(2000006), cnt(2000006), sum(2000006);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> x >> y;
  for (long long int i = 1; i <= n; i++) cin >> a[i], b[a[i]]++;
  for (long long int i = 1; i < 2000006; i++)
    cnt[i] = cnt[i - 1] + b[i], sum[i] = sum[i - 1] + b[i] * i;
  long long int c = x / y;
  long long int ans = INT64_MAX;
  for (long long int i = 2; i <= 1e6; i++) {
    long long int cost = 0, f = i - min(i, c);
    for (long long int j = 0; j <= 1e6; j += i) {
      long long int st = j + 1, en = j + i, st2 = max(st, st + f - 1);
      long long int c1 = cnt[st2 - 1] - cnt[st - 1];
      long long int c2 = cnt[en] - cnt[st2 - 1];
      long long int c3 = sum[en] - sum[st2 - 1];
      cost += c1 * x + y * (c2 * en - c3);
    }
    ans = min(ans, cost);
  }
  cout << ans << '\n';
}
