#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vll = vector<ll>;
using pdd = pair<double, double>;
using vpdd = vector<pdd>;
template <typename T>
using uset = unordered_set<T>;
template <typename T>
using umultiset = unordered_multiset<T>;
template <typename K, typename V>
using umap = unordered_map<K, V>;
template <typename K, typename V>
using umultimap = unordered_multimap<K, V>;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, -1, 1};
const double eps = 1e-9;
const int INF = 0x7FFFFFFF;
const ll INFLL = 0x7FFFFFFFFFFFFFFFLL;
const double pi = acos(-1);
template <typename T>
T take(queue<T>& O) {
  T tmp = O.front();
  O.pop();
  return tmp;
}
template <typename T>
T take(stack<T>& O) {
  T tmp = O.top();
  O.pop();
  return tmp;
}
template <typename T>
T take(priority_queue<T>& O) {
  T tmp = O.top();
  O.pop();
  return tmp;
}
template <typename T>
inline bool inRange(const T& z, const T& a, const T& b) {
  return a <= z && z <= b;
}
void OPEN(const string& in = "input.txt", const string& out = "output.txt") {
  freopen(in.c_str(), "r", stdin);
  freopen(out.c_str(), "w", stdout);
  return;
}
ll cnt[2000005];
ll kurang[2000005];
int n, a;
ll x, y;
ll ans = INFLL;
bitset<1000001> isp;
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> x >> y;
  for (int(i) = (0), _t = (n); i < (_t); ++(i)) {
    cin >> a;
    ++cnt[a];
  }
  for (int(i) = (1), _t = (2000000); i <= (_t); ++(i)) {
    cnt[i] += cnt[i - 1];
    kurang[i] = kurang[i - 1] + cnt[i - 1];
  }
  ll garugi = x / y + 1;
  isp.set();
  for (int(i) = (2), _t = (1000000); i <= (_t); ++(i)) {
    if (isp.test(i)) {
      ll tmpCost = 0LL;
      int c = 0;
      while (c <= 1000000) {
        c += i;
        if (c <= 1000000) isp.set(c, 0);
        ll ccnt = 0;
        ll ckurang = 0LL;
        if (i > garugi) {
          ccnt = 0;
          if (c - garugi >= 0) ccnt += cnt[c - garugi];
          if (c - i >= 0) ccnt -= cnt[c - i];
          tmpCost += x * ccnt;
          ckurang = kurang[c];
          if (c - garugi + 1 >= 0) ckurang -= kurang[c - garugi + 1];
          if (c - garugi >= 0) ckurang -= cnt[c - garugi] * (garugi - 1);
          tmpCost += y * ckurang;
        } else {
          ckurang = kurang[c];
          ckurang -= kurang[c - i + 1];
          ckurang -= cnt[c - i] * (i - 1);
          tmpCost += y * ckurang;
        }
      }
      ans = min(ans, tmpCost);
    }
  }
  ans = min(ans, x * n);
  cout << ans << "\n";
}
