#include <bits/stdc++.h>
using namespace std;
long long dot(pair<long long, long long> u, pair<long long, long long> v) {
  return u.first * v.first + u.second * v.second;
}
long long cross(pair<long long, long long> u, pair<long long, long long> v) {
  return u.first * v.second - u.second * v.first;
}
long long ccw(pair<long long, long long> u, pair<long long, long long> v) {
  long long val = cross(u, v);
  if (val > 0)
    return 1;
  else if (val == 0)
    return 0;
  else
    return -1;
}
pair<long long, long long> vec(pair<long long, long long> a,
                               pair<long long, long long> b) {
  return pair<long long, long long>(b.first - a.first, b.second - a.second);
}
pair<long long, long long> O;
bool cmpAngle(pair<long long, long long> A, pair<long long, long long> B) {
  pair<long long, long long> OA = vec(O, A);
  pair<long long, long long> OB = vec(O, B);
  if (ccw(OA, OB) == 0)
    return dot(OA, OA) < dot(OB, OB);
  else
    return ccw(OA, OB) > 0;
}
vector<pair<long long, long long> > convexHull(
    vector<pair<long long, long long> >& point) {
  vector<pair<long long, long long> > hull;
  sort(point.begin(), point.end());
  O = point[0];
  sort(point.begin() + 1, point.end(), cmpAngle);
  vector<pair<long long, long long> > checker;
  checker.push_back(O);
  for (long long i = 1; i < point.size(); i++) {
    while (i + 1 < point.size() &&
           ccw(vec(O, point[i]), vec(O, point[i + 1])) == 0)
      ++i;
    checker.push_back(point[i]);
  }
  if (checker.size() < 3) return hull;
  hull.push_back(O);
  hull.push_back(point[1]);
  for (long long i = 2; i < checker.size(); i++) {
    while (true) {
      pair<long long, long long> curr = hull.back();
      hull.pop_back();
      pair<long long, long long> prev = hull.back();
      hull.push_back(curr);
      pair<long long, long long> next = checker[i];
      if (ccw(vec(prev, curr), vec(prev, next)) == 1) {
        hull.push_back(next);
        break;
      } else
        hull.pop_back();
    }
  }
  return hull;
}
pair<double, double> solve(long long A, long long B, long long E, long long C,
                           long long D, long long F) {
  long long Det = A * D - B * C;
  long long DetX = E * D - B * F;
  long long DetY = A * F - C * E;
  if (Det == 0)
    return pair<double, double>(1e18, 1e18);
  else {
    return pair<double, double>(DetX / double(Det), DetY / double(Det));
  }
}
vector<long long> P;
vector<long long> R;
void init(long long n) {
  R = vector<long long>(n);
  P = vector<long long>(n);
  for (long long i = 0; i < n; i++) {
    P[i] = i;
  }
}
long long root(long long x) {
  if (P[x] != x) return P[x] = root(P[x]);
  return P[x];
}
void link(long long x, long long y) {
  long long rx = root(x);
  long long ry = root(y);
  if (R[rx] > R[ry]) swap(rx, ry);
  P[rx] = ry;
  if (R[rx] == R[ry]) ++R[ry];
}
void update(long long node, long long left, long long right, long long pos,
            long long val, vector<long long>& tree) {
  if (left == right)
    tree[node] = val;
  else {
    long long mid = (left + right) / 2;
    if (pos <= mid)
      update(2 * node + 1, left, mid, pos, val, tree);
    else
      update(2 * node + 2, mid + 1, right, pos, val, tree);
    tree[node] = tree[2 * node + 1] + tree[2 * node + 2];
  }
}
long long query(long long node, long long left, long long right,
                long long start, long long end, vector<long long>& tree) {
  if (end < left && right < start)
    return 0;
  else if (start <= left && right <= end)
    return tree[node];
  else {
    long long mid = (left + right) / 2;
    long long p1 = query(2 * node + 1, left, mid, start, end, tree);
    long long p2 = query(2 * node + 2, mid + 1, right, start, end, tree);
    return p1 + p2;
  }
}
long long powerMod(long long b, long long p, long long m) {
  if (p == 0)
    return 1 % m;
  else if (p == 1)
    return b % m;
  else {
    long long tmp = powerMod(b, p / 2, m);
    tmp = (tmp * tmp) % m;
    if (p & 1)
      return (b % m * tmp) % m;
    else
      return tmp;
  }
}
long long multiplyMod(long long a, long long b, long long m) {
  if (b == 0)
    return 0;
  else if (b == 1)
    return a % m;
  else {
    if (b & 1)
      return (a % m + multiplyMod(a, b - 1, m)) % m;
    else
      return (2 % m * multiplyMod(a, b / 2, m)) % m;
  }
}
vector<long long> vec5(vector<long long>& a, vector<long long>& b) {
  vector<long long> ans(5);
  for (long long i = 0; i < 5; i++) {
    ans[i] = b[i] - a[i];
  }
  return ans;
}
long long dot5(vector<long long>& a, vector<long long>& b) {
  long long ans = 0;
  for (long long i = 0; i < 5; i++) {
    ans += a[i] * b[i];
  }
  return ans;
}
int main() {
  long long n, del, inc;
  cin >> n >> del >> inc;
  vector<long long> ar(n);
  vector<long long> cnt(2 * 1e6 + 10);
  vector<long long> sum(2 * 1e6 + 10);
  long long Max = 0;
  for (long long i = 0; i < n; i++) {
    cin >> ar[i];
    Max = max(ar[i], Max);
    cnt[ar[i]]++;
    sum[ar[i]] += ar[i];
  }
  for (long long i = 1; i <= 2 * 1e6; i++) {
    cnt[i] += cnt[i - 1];
    sum[i] += sum[i - 1];
  }
  long long ans = 1e18;
  for (long long gcd = 2; gcd <= 1e6; gcd++) {
    long long curr = 0;
    for (long long top = gcd; top <= 1e6 + gcd; top += gcd) {
      long long btm = top - gcd;
      long long mid = max(btm + 1, top - min(gcd, del / inc));
      if (btm <= mid - 1) {
        curr += del * (cnt[mid - 1] - cnt[btm]);
      }
      if (mid - 1 <= top - 1) {
        curr += inc * (top * (cnt[top - 1] - cnt[mid - 1]) -
                       (sum[top - 1] - sum[mid - 1]));
      }
    }
    ans = min(ans, curr);
  }
  cout << ans << endl;
}
