#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
#pragma GCC optimize("O3")
using namespace std;
const long long N = 1e5 + 10;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
const long long inf = -1e18;
const long long M = 1e6;
int n, x, y, a[5 * N];
bool us[1000010];
int used[1000010];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  cin >> n >> x >> y;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    used[a[i]]++;
  }
  long long ans = INF;
  for (int i = 2; i <= 1000000; i++) {
    if (us[i] == 0) {
      long long s = used[i];
      for (int j = i + i; j <= 1000000; j += i) {
        us[j] = 1;
        s += used[j];
      }
      if ((n - s) * min(x, y) >= ans) continue;
      long long cnt = 0;
      for (int j = 1; j <= n; j++) {
        if (a[j] % i != 0) {
          long long t = a[j] % i;
          cnt += min(1ll * x, 1ll * (i - t) * y);
        }
      }
      ans = min(ans, 1ll * cnt);
    }
  }
  cout << ans;
  cin.get(), cin.get();
  return 0;
}
