#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e10;
const long long N = 1000100;
long long n, a[N], sum[2 * N], qu[2 * N], ans = INF, x, y;
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> x >> y;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    ++qu[a[i]];
    sum[a[i]] += a[i];
  }
  for (int i = 0; i < 2000010; ++i) {
    qu[i + 1] += qu[i];
    sum[i + 1] += sum[i];
  }
  long long m = x / y;
  ans = n * x;
  for (long long i = 2; i <= N; i++) {
    long long anss = 0;
    for (long long j = i; j <= N + i && anss < ans; j += i) {
      int k = max(j - i, j - m - 1);
      anss += ((qu[j] - qu[k]) * j - (sum[j] - sum[k])) * y;
      anss += (qu[k] - qu[j - i]) * x;
    }
    ans = min(ans, anss);
  }
  cout << ans;
  return 0;
}
