#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN = 2e6;
const LL INF = 1e18;
int a[MAXN];LL s[MAXN],used[MAXN];
int main(){
LL n,x,y;
cin>>n>>x>>y;
int p = x/y;
for(int i = 1;i <= n;i++){
int tmp;scanf("%d",&tmp);
a[tmp]++;s[tmp] += (LL)tmp;
}
LL ans = INF;
for(int i = 1;i < MAXN;i++)
a[i] += a[i-1],s[i] += s[i-1];
for(int i = 2;i <= 1000000;i++){
if(used[i]) continue;
LL tmp = 0;
for(int j = i;j <= 1000000 + i;j += i){
used[j] = 1;
int k = max(j - i + 1,j - p );
tmp +=((LL)(a[j] - a[k-1])*j - (s[j] - s[k-1]))*y + (LL)(a[k-1] - a[j-i])*x;
}
ans = min(ans,tmp);
}
cout<<ans<<endl;
return 0;
}
/*
4
5 1
1 17 17 17
*/