#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
long long sum[2000010], cnt[2000010];
int main() {
  int n;
  long long x, y;
  scanf("%d %lld %lld", &n, &x, &y);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    sum[a] += a;
    cnt[a]++;
  }
  for (int i = 1; i <= 2000000; i++) {
    sum[i] += sum[i - 1];
    cnt[i] += cnt[i - 1];
  }
  vector<int> is_prime(2000010, true);
  int p = x / y;
  long long ans = INF;
  for (int i = 2; i <= 1000000; i++) {
    if (!is_prime[i]) continue;
    long long cost = 0;
    for (int j = i; j <= 1000000 + i; j += i) {
      is_prime[j] = false;
      long long hoge = max(j - p - 1, j - i);
      cost += (cnt[hoge] - cnt[j - i]) * x;
      cost += (j * (cnt[j] - cnt[hoge]) - (sum[j] - sum[hoge])) * y;
    }
    ans = min(ans, cost);
  }
  printf("%lld\n", ans);
  return 0;
}
