#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 5;
const int MAXA = 2e6 + 3;
const long long int INF = 1000000000000000;
int n, xy;
long long int ans, x, y, cnt[MAXA], sum[MAXA];
long long int C(int i, int j) {
  if (i > j) return 0;
  return cnt[j] - cnt[i - 1];
}
long long int S(int i, int j) {
  if (i > j) return 0;
  return sum[j] - sum[i - 1];
}
int main() {
  memset(cnt, 0, sizeof(cnt));
  memset(sum, 0, sizeof(sum));
  scanf("%d%lld%lld", &n, &x, &y);
  for (int i = 1, a; i <= n; ++i) {
    scanf("%d", &a);
    ++cnt[a];
    sum[a] += a;
  }
  for (int i = 1; i < MAXA; ++i) {
    cnt[i] += cnt[i - 1];
    sum[i] += sum[i - 1];
  }
  ans = INF;
  xy = x / y;
  for (int i = 2, mid; i < MAXA; ++i) {
    long long int cost = 0;
    for (int j = i; j < MAXA; j += i) {
      mid = max(j - i + 1, j - xy);
      cost += y * (C(mid, j) * j - S(mid, j));
      cost += x * C(j - i + 1, mid - 1);
    }
    if (cost >= 0) {
      ans = min(ans, cost);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
