#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct outputer;
struct outputable {};
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 500000;
const int X = 1000000;
struct Input {
  int n;
  int64_t x, y;
  int a[N];
  bool read() {
    if (!(cin >> n >> x >> y)) {
      return 0;
    }
    for (int i = int(0); i < int(n); ++i) {
      scanf("%d", &a[i]);
    }
    return 1;
  }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  int64_t ans;
  void write() { cout << ans << endl; }
};
namespace Main {
struct Solution : Data {
  int64_t cnt[2 * X + 2];
  int64_t sum[2 * X + 2];
  void solve() {
    memset(cnt, 0, sizeof cnt);
    memset(sum, 0, sizeof sum);
    for (int i = int(0); i < int(n); ++i) {
      cnt[a[i] + 1]++;
      sum[a[i] + 1] += a[i];
    }
    for (int i = int(0); i < int(2 * X + 1); ++i) {
      cnt[i + 1] += cnt[i];
      sum[i + 1] += sum[i];
    };
    ;
    ans = n * y;
    int k = x / y;
    for (int i = int(2); i < int(X + 1); ++i) {
      int64_t cur = 0;
      for (int j = 0; j <= X; j += i) {
        int lb = j + 1;
        int rb = j + i + 1;
        int md = j + i - k;
        umx(md, lb);
        umn(md, rb);
        cur += (cnt[md] - cnt[lb]) * x;
        cur += ((cnt[rb] - cnt[md]) * (j + i) - (sum[rb] - sum[md])) * y;
        ;
        ;
        ;
        if (cur > ans) {
          break;
        }
      }
      umn(ans, cur);
    }
  }
  void clear() { *this = Solution(); }
};
}  // namespace Main
Main::Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}
