#include <bits/stdc++.h>
using namespace std;
const int maxn = 500005;
const int maxnum = 1e6 + 5;
int a[maxn];
int sum[maxnum];
int vis[maxnum];
int main() {
  int n, x, y;
  scanf("%d%d%d", &n, &x, &y);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum[a[i]]++;
  }
  long long cnt = 0x3f3f3f3f3f3f3f3fll;
  for (int i = 2; i <= 1000000; i++) {
    if (!vis[i]) {
      long long ans = sum[i];
      for (int j = 2 * i; j <= 1000000; j += i) {
        vis[j] = 1;
        ans += sum[j];
      }
      if ((n - ans) * min(x, y) < cnt) {
        long long tans = 0;
        for (int j = 0; j < n; j++) {
          if (a[j] % i) {
            long long t = a[j] % i;
            tans += min((long long)1 * x, (long long)1 * y * (i - t));
          }
        }
        cnt = min(cnt, tans);
      }
    }
  }
  printf("%lld\n", cnt);
  return 0;
}
