#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 1e6 + 9;
const int shift = 1e5 + 9;
const double Eps = 1e-6;
long long n, first, second, ans, sum, ba;
int a[N], cnt, vis[N], num[N];
int main(void) {
  if (fopen("in", "r") != NULL) {
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
  }
  while (cin >> n >> first >> second) {
    memset(num, 0, sizeof num);
    for (int i = 0; i < n; i++) {
      scanf("%d", a + i);
      num[a[i]]++;
    }
    int up = 1e6;
    ans = INF;
    memset(vis, 0, sizeof vis);
    for (int i = 2; i <= up; i++) {
      if (vis[i] == 1) continue;
      long long sum1 = num[i];
      for (int j = 2 * i; j <= up; j += i) {
        vis[j] = 1;
        sum1 += num[j];
      }
      if (1LL * (n - sum1) * min(first, second) < ans) {
        sum = 0;
        for (int j = 0; j < n; j++) {
          if (a[j] % i == 0) continue;
          long long t = i - a[j] % i;
          sum += min(first, t * second);
        }
      }
      ans = min(ans, sum);
    }
    printf("%lld\n", ans);
  }
  return 0;
}
