#include <bits/stdc++.h>
using namespace std;
long long sum[2000100], num[2000100];
bool isprime[2000100] = {1, 1};
long long prime[100000];
long long num_prime;
void getprime() {
  for (int i = 2; i < 1000000; i++) {
    if (!isprime[i]) prime[num_prime++] = i;
    for (int j = 0; j < num_prime && i * prime[j] < 1000000; j++) {
      isprime[i * prime[j]] = 1;
      if (i % prime[j] == 0) break;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  long long n, x, y, t;
  cin >> n >> x >> y;
  getprime();
  long long maxn = 0;
  for (int i = 1; i <= n; i++) {
    cin >> t;
    num[t]++;
    sum[t] += t;
    maxn = max(maxn, t);
  }
  for (int i = 1; i <= 2 * maxn; i++)
    sum[i] += sum[i - 1], num[i] += num[i - 1];
  long long rate = x / y;
  long long ans = 1e18;
  for (int i = 0; i < num_prime && prime[i - 1] <= maxn; i++) {
    long long now = 0;
    for (long long j = 0; j <= maxn; j += prime[i]) {
      long long limit = max((j + prime[i]) - rate, j + 1);
      long long Num = num[j + prime[i]] - num[limit - 1];
      long long Sum = sum[j + prime[i]] - sum[limit - 1];
      long long NNum = num[limit - 1] - num[j];
      now += y * (Num * (j + prime[i]) - Sum);
      now += NNum * x;
      if (now >= ans) break;
    }
    ans = min(ans, now);
  }
  cout << ans << endl;
}
