#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
double fRand(double fMin, double fMax) {
  double f = (double)rand() / RAND_MAX;
  return fMin + f * (fMax - fMin);
}
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
int n, x, y, a[500005], cnt[1000005];
long long sum[1000005];
int main() {
  scanf("%d%d%d", &n, &x, &y);
  for (int i = (1); i <= (n); ++i) scanf("%d", &a[i]);
  for (int i = (1); i <= (n); ++i) {
    ++cnt[a[i]];
    sum[a[i]] += a[i];
  }
  for (int i = (1); i <= (1000005 - 1); ++i) {
    cnt[i] += cnt[i - 1];
    sum[i] += sum[i - 1];
  }
  long long ans = 1000000000000000007LL;
  for (int d = (2); d <= (1000005 - 1); ++d) {
    long long cur = 0;
    for (int i = 1; i < 1000005; i += d) {
      int l = i, r = min(1000005 - 1, i + d - 1);
      int k = max(l - 1, min(r, i + d - x / y - 2));
      long long cntX = cnt[k] - cnt[l - 1],
                cntY = 1LL * (cnt[r] - cnt[k]) * (d * (i / d + 1)) -
                       (sum[r] - sum[k]);
      cur += 1LL * cntX * x + 1LL * cntY * y;
    }
    ans = min(ans, cur);
  }
  cout << ans;
  return 0;
}
