#include <bits/stdc++.h>
using namespace std;
long long n, x, y;
long long a[500005], sum[2000005], cnt[2000005];
long long maxx;
long long id;
long long ans = 0x7fffffffffffffff;
signed main() {
  cin >> n >> x >> y;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    maxx = max(maxx, a[i]);
    cnt[a[i]]++;
    sum[a[i]] += a[i];
  }
  if (maxx == 1) {
    cout << n * min(x, y);
    return 0;
  }
  for (long long i = 1; i <= maxx * 2; i++) {
    sum[i] += sum[i - 1];
    cnt[i] += cnt[i - 1];
  }
  for (long long i = 2; i <= maxx; i++) {
    long long tmpans = 0;
    for (long long j = i; j <= maxx + i; j += i) {
      long long l = j - i + 1, r = j;
      id = r - ceil((double)(x / y) + 0.5);
      if (id >= l)
        tmpans += x * (cnt[id] - cnt[l - 1]);
      else
        id = l - 1;
      tmpans += y * (r * (cnt[r] - cnt[id]) - (sum[r] - sum[id]));
    }
    ans = min(ans, tmpans);
  }
  cout << ans;
  return 0;
}
