#include <bits/stdc++.h>
using namespace std;
const long long M = 3e6 + 10;
long long cnt[M], sum[M];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, x, y;
  cin >> n >> x >> y;
  for (long long i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    cnt[x]++, sum[x] += x;
  }
  for (long long i = 1; i < M; ++i) cnt[i] += cnt[i - 1], sum[i] += sum[i - 1];
  long long k = x / y, ans = (long long)(1e18);
  for (long long i = 2; i < M; ++i) {
    long long now = 0;
    for (long long j = i; j < M; j += i) {
      if (k >= i - 1)
        now += (j * (cnt[j] - cnt[j - i]) - (sum[j] - sum[j - i])) * y;
      else
        now += (j * (cnt[j] - cnt[j - k - 1]) - (sum[j] - sum[j - k - 1])) * y +
               x * (cnt[j - k - 1] - cnt[j - i]);
    }
    ans = min(ans, now);
  }
  cout << ans;
  return 0;
}
