#include <bits/stdc++.h>
using namespace std;
long long int n, x, y;
long long int a[2000100];
long long int conta[2000100];
long long int soma[2000100];
long long int menor_custo;
long long int sieve_size;
long long int cntF(int l, int r) {
  long long int s = conta[r] - conta[l - 1];
  return s;
}
long long int sumF(int l, int r) {
  long long int s = soma[r] - soma[l - 1];
  return s;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int left, right;
  long long int cost = 0;
  long long int f = 0;
  long long int min_cost = 1e+16;
  cin >> n >> x >> y;
  memset(conta, 0, sizeof(conta));
  memset(soma, 0, sizeof(soma));
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    soma[a[i]] += a[i];
    conta[a[i]] += 1;
  }
  for (int i = 1; i < 2000100; i++) {
    soma[i] += soma[i - 1];
    conta[i] += conta[i - 1];
  }
  cost = 0;
  for (long long int i = 2; i < 2000100; i++) {
    cost = 0;
    for (long long int j = i; j < 2000100; j += i) {
      f = j - min((x / y), i) - 1;
      f = max(f, j - i);
      cost += cntF(j - i + 1, f) * x;
      cost += (cntF(f + 1, j) * j - sumF(f + 1, j)) * y;
    }
    if (min_cost > cost) min_cost = cost;
  }
  cout << min_cost << endl;
  return 0;
}
