#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  void solve(std::istream& in, std::ostream& out) {
    long long n, x, y;
    in >> n >> x >> y;
    std::vector<long long> a(n);
    for (auto& el : a) in >> el;
    long long max_num = *std::max_element(a.begin(), a.end());
    ++max_num;
    std::vector<bool> is_not_p(max_num + 1);
    std::vector<long long> primes;
    for (long long i = 2; i <= max_num; ++i) {
      if (!is_not_p[i]) {
        primes.push_back(i);
        for (long long j = 2 * i; j <= max_num; j += i) is_not_p[j] = true;
      }
    }
    std::vector<long long> cnt(max_num + 1), sum(max_num + 1);
    std::sort(a.begin(), a.end());
    auto it = a.begin();
    long long cur_cnt = 0, cur_sum = 0;
    for (long long i = 0; i <= max_num; ++i) {
      while (it != a.end() && *it == i) {
        ++cur_cnt;
        cur_sum += *it;
        ++it;
      }
      sum[i] = cur_sum;
      cnt[i] = cur_cnt;
    }
    long long ans = std::numeric_limits<long long>::max();
    for (auto p : primes) {
      long long cur_sum = 0;
      for (long long to = p; to <= ((max_num + p - 1) / p * p); to += p) {
        auto get = [](std::vector<long long>& val, long long ind) {
          return ind >= val.size() ? val.back() : val[ind];
        };
        auto v = std::max(to - (x + y - 1) / y, to - p);
        cur_sum +=
            (get(cnt, v) - get(cnt, to - p)) * x +
            ((get(cnt, to) - get(cnt, v)) * to - (get(sum, to) - get(sum, v))) *
                y;
      }
      ans = std::min(ans, cur_sum);
    }
    out << ans << '\n';
  }
};
void solve(std::istream& in, std::ostream& out) {
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  ostream& out = cout;
  solve(in, out);
  return 0;
}
