#include <bits/stdc++.h>
using namespace std;
const long long M = 5e5 + 5, N = 2e6 + 5;
long long n, x, y;
long long A[M], Mx;
long long cnt[N], sum[N];
int main() {
  scanf("%lld%lld%lld", &n, &x, &y);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &A[i]);
    Mx = max(Mx, A[i]);
    cnt[A[i]]++;
    sum[A[i]] += A[i];
  }
  if (Mx == 1) {
    printf("%lld", n * min(x, y));
    return 0;
  }
  for (long long i = 1; i <= N - 4; i++) {
    sum[i] += sum[i - 1];
    cnt[i] += cnt[i - 1];
  }
  long long inc_Mx = ceil(x * 1.0 / y + 0.5), ans = 1e18;
  for (long long i = 2; i <= Mx; i++) {
    long long tem = 0;
    for (long long j = i; j <= Mx + i; j += i) {
      long long r = j;
      long long l = r - i + 1;
      long long f = r - inc_Mx;
      if (f >= l)
        tem += x * (cnt[f] - cnt[l - 1]);
      else
        f = l - 1;
      tem += y * ((cnt[r] - cnt[f]) * r - (sum[r] - sum[f]));
    }
    ans = min(ans, tem);
  }
  printf("%lld", ans);
  return 0;
}
