#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-8;
const int N = 5e5 + 100;
const int M = 2e6 + 100;
const int MOD = 1e9 + 7;
struct BIT {
  long long sum[M];
  int n;
  void init(int _n) {
    memset(sum, 0, sizeof(sum));
    n = _n;
  }
  void add(int p, int first) {
    for (; p <= n; p += p & -p) sum[p] += first;
  }
  long long get_sum(int p) {
    long long ret = 0;
    for (; p > 0; p -= p & -p) ret += sum[p];
    return ret;
  }
  long long sum_range(int l, int r) {
    if (l > r) return 0;
    return get_sum(r) - get_sum(l - 1);
  }
} t, s;
int n, first, second;
int a[N];
bool vis[M];
int prm[N], sz;
int main() {
  memset(vis, 0, sizeof(vis));
  sz = 0;
  for (int i = 2; i < M; i++) {
    if (!vis[i]) {
      prm[sz++] = i;
      for (long long j = (long long)i * i; j < M; j += i) vis[j] = true;
    }
  }
  t.init(M);
  s.init(M);
  scanf("%d%d%d", &n, &first, &second);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]), t.add(a[i], 1), s.add(a[i], a[i]);
  }
  int w = first / second;
  long long ans = (long long)first * n;
  for (int i = 0; i < sz; i++) {
    long long tmp = 0;
    int del_num = 0;
    for (int j = prm[i]; j < M; j += prm[i]) {
      long long num1 = t.sum_range(j - prm[i] + 1, j - w - 1);
      long long num2 = t.sum_range(max(j - w, j - prm[i] + 1), j - 1);
      long long sum2 = s.sum_range(max(j - w, j - prm[i] + 1), j - 1);
      del_num += num1;
      tmp += num1 * first + (num2 * j - sum2) * second;
    }
    if (del_num != n) ((ans) = min(ans, tmp));
  }
  cout << ans << endl;
  return 0;
}
