#include <bits/stdc++.h>   using namespace std;   const int N = 2e6 + 15;   int cc[N];   long long sum[N];   long long getSeg(int pos, int p, int x, int y) {     int last = pos + p - 1;     int t = x / y;     int ed = max(pos, last - t);     long long ret = (long long)(cc[ed] - cc[pos]) * x;     long long tot = (long long)(cc[last] - cc[ed]);     long long u = pos + p;     tot *= u;     long long totSum = sum[last] - sum[ed];     ret += (tot - totSum) * y;     return ret;   }   bool isPrime[N];   void solve() {     int n, x, y;     scanf( %d%d%d , &n, &x, &y);     for (int i = 0; i < n; ++i) {       int a;       scanf( %d , &a);       ++cc[a];       sum[a] += a;     }     for (int i = 1; i < N; ++i) {       cc[i] += cc[i - 1];       sum[i] += sum[i - 1];     }     for (int i = 2; i < N; ++i) {       if (!isPrime[i]) {         for (int j = i + i; j < N; j += i) isPrime[j] = true;       }     }     long long ret = 1e18;     for (int i = 2; i <= 1e6; ++i) {       if (isPrime[i]) continue;       long long tot = 0;       for (int pos = 0; pos <= 1e6; pos += i) {         tot += getSeg(pos, i, x, y);       }       ret = min(ret, tot);     }     cout << ret << endl;   }   int main() { solve(); }   