#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double PI = acos(-1);
const double EPS = 1e-6;
const int INF = 0x3f3f3f3f;
inline int readint() {
  int sum = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  if (f) return -sum;
  return sum;
}
inline long long readLL() {
  long long sum = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  if (f) return -sum;
  return sum;
}
int cnt[2000005];
long long sum[2000005];
const int maxn = 1000000;
bool v[maxn + 5];
int prime[maxn / 10];
int num;
void PrimeInit(int MAXNUM) {
  num = 0;
  for (int i = 2; i <= MAXNUM; i++) {
    if (!v[i]) prime[num++] = i;
    for (int j = 0; j < num; j++) {
      int temp = i * prime[j];
      if (temp > MAXNUM) break;
      v[temp] = true;
      if (i % prime[j] == 0) break;
    }
  }
}
int main() {
  PrimeInit(1000000);
  int n = readint(), a = readint(), b = readint();
  for (int i = 1; i <= n; i++) {
    int x = readint();
    cnt[x]++;
  }
  for (int i = 1; i <= 2000000; i++) {
    sum[i] = sum[i - 1] + 1LL * i * cnt[i];
    cnt[i] = cnt[i - 1] + cnt[i];
  }
  int s = a / b;
  long long ans = 1e18;
  for (int i = 0; i < num; i++) {
    int x = prime[i];
    long long sum1 = 0;
    for (int j = x, pre = 0; j <= 2000000; pre = j, j = j + x) {
      int ss = max(pre + x - s - 1, pre);
      sum1 += 1LL * (cnt[ss] - cnt[pre]) * a;
      sum1 += 1LL * (1LL * j * (cnt[j] - cnt[ss]) - (sum[j] - sum[ss])) * b;
    }
    ans = min(ans, sum1);
  }
  printf("%lld\n", ans);
  return 0;
}
