#include <bits/stdc++.h>
using namespace std;
const long long maxn = 500010;
const int max_num = 1000010;
long long pri[max_num];
long long a[maxn];
long long vis[max_num];
long long cnt, n;
long long x, y;
int main() {
  scanf("%I64d%I64d%I64d", &n, &x, &y);
  for (long long i = 0; i < n; i++) {
    scanf("%I64dd", &a[i]);
    vis[a[i]]++;
  }
  long long ans = 1e16;
  for (long long i = 2; i <= max_num; i++) {
    long long cnt = 0;
    if (!pri[i]) {
      for (long long j = i; j <= max_num; j += i) {
        cnt += vis[j];
        pri[j] = 1;
      }
      if ((n - cnt) * min(x, y) < ans) {
        long long rec = 0;
        for (long long j = 0; j < n; j++) {
          long long tmp = a[j] % i;
          if (tmp) rec += min(x, y * (i - tmp));
        }
        ans = min(rec, ans);
      }
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
