#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
#pragma GCC optimize("O3")
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
const int maxn = 1e6 + 10;
const long long mod = 1e9 + 7;
long long fsp(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans % mod;
}
inline void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
}
int n, x, y;
long long sum[maxn], tt[maxn];
void work() {
  int mx = 0, ct = x / y;
  memset(sum, 0, sizeof(sum));
  memset(tt, 0, sizeof(tt));
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    sum[x]++;
    mx = max(mx, x);
  }
  mx = max(mx, 2);
  for (int i = 1; i <= mx; ++i) {
    tt[i] = tt[i - 1] + 1LL * sum[i] * i;
    sum[i] += sum[i - 1];
  }
  long long ans = 0x3f3f3f3f3f3f3f3f;
  for (int i = 2; i <= mx; ++i) {
    long long tot = 0;
    for (int j = 0; j <= mx; j += i) {
      int tp = min(j + i, mx), low = max(min(j + i - ct - 1, tp), j);
      tot +=
          1LL * (1LL * (sum[tp] - sum[low]) * (j + i) - (tt[tp] - tt[low])) * y;
      tot += 1LL * (sum[low] - sum[j]) * x;
    }
    if (tot < 0) continue;
    ans = min(ans, tot);
  }
  cout << ans << endl;
}
int main() {
  while (~scanf("%d%d%d", &n, &x, &y)) work();
  return 0;
}
