#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int K = 3e6 + 7;
const int mod = 1e9 + 7;
long long vis[K], sum[K], cnt[K], ans = 1e18;
int main(void) {
  int n, x, y;
  cin >> n >> x >> y;
  for (int i = 1, a; i <= n; i++) scanf("%d", &a), cnt[a]++, sum[a] += a;
  for (int i = 1; i <= 3000000; i++) cnt[i] += cnt[i - 1], sum[i] += sum[i - 1];
  for (int i = 2, k = x / y; i <= 1000000; i++)
    if (!vis[i]) {
      long long tmp = 0;
      for (int l = i, mx = 2000000 + i; l <= mx; l += i) {
        vis[l] = 1;
        int mid = l - k - 1;
        if (mid <= l - i)
          tmp += ((cnt[l] - cnt[l - i]) * l - (sum[l] - sum[l - i])) * y;
        else
          tmp += (cnt[mid] - cnt[l - i]) * x +
                 ((cnt[l] - cnt[mid]) * l - (sum[l] - sum[mid])) * y;
      }
      ans = min(tmp, ans);
    }
  cout << ans << endl;
  return 0;
}
