#include <bits/stdc++.h>
using namespace std;
const int N = 2000000 + 10;
int n;
long long x, y;
long long cnt[N];
long long pre[N];
void solve() {
  cin >> n >> x >> y;
  for (int i = 0; i < n; ++i) {
    int t;
    scanf("%d", &t);
    cnt[t]++;
    pre[t] += t;
  }
  long long ans = x * n;
  long long c = x / y;
  for (int i = 1; i < N; ++i) {
    cnt[i] += cnt[i - 1];
    pre[i] += pre[i - 1];
  }
  for (int d = 2; d <= 1000000; ++d) {
    long long tmp_ans = 0;
    for (int i = 0; i + d < N; i += d) {
      if (i + d - c > i + 1) {
        tmp_ans += (cnt[i + d - c - 1] - cnt[i]) * x;
      }
      int st = max(i + d - c, i + 1ll);
      tmp_ans += ((cnt[i + d - 1] - cnt[st - 1]) * (i + d) -
                  (pre[i + d - 1] - pre[st - 1])) *
                 y;
    }
    ans = min(ans, tmp_ans);
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
