#include <bits/stdc++.h>
using namespace std;
int l, r, k, a[500010];
long long n, x, y, s, mx, ans = 4000000000000000000, sum[2000010], cnt[2000010];
int main() {
  cin >> n >> x >> y;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    mx = max(mx, a[i] * 1ll);
    cnt[a[i]]++;
    sum[a[i]] = sum[a[i]] + a[i] * 1ll;
  }
  if (mx == 1) {
    cout << n * min(x, y);
    return 0;
  }
  for (int i = 1; i <= mx * 2; ++i) {
    sum[i] += sum[i - 1];
    cnt[i] += cnt[i - 1];
  }
  for (int i = 2; i <= mx; ++i) {
    s = 0;
    for (int j = i; j <= mx + i; j += i) {
      l = j - i + 1;
      r = j;
      k = r - ceil((double)(x / y) + 0.5);
      if (k >= l) {
        s += x * (cnt[k] - cnt[l - 1]);
      } else {
        k = l - 1;
      }
      s += y * (r * (cnt[r] - cnt[k]) - (sum[r] - sum[k]));
    }
    ans = min(ans, s);
  }
  cout << ans;
  return 0;
}
