#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int const N = 2000 * 1000 + 16;
int const M = 1000 * 1000 * 1000 + 7;
int n;
ll x, y, b[N];
int a[N], c[N], p[N];
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  cin >> n >> x >> y;
  int mx = 2;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    c[a[i]]++;
    b[a[i]] += a[i];
    mx = max(mx, a[i]);
  }
  mx <<= 1;
  for (int i = 1; i <= mx; ++i) {
    b[i] += b[i - 1];
    c[i] += c[i - 1];
  }
  int z = x / y + 1;
  ll best = 1ll * n * x;
  for (int i = 2; i <= mx; ++i)
    if (not p[i]) {
      ll cost = 0;
      for (int j = i; j <= mx; j += i) {
        p[j] = 1;
        int l = j - i;
        int m = max(j - z, l);
        int r = j;
        cost += x * (c[m] - c[l]);
        cost += y * (1ll * j * (c[r] - c[m]) - (b[r] - b[m]));
      }
      best = min(best, cost);
    }
  cout << best;
}
