#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const int N = 2e6 + 7;
int cnt[N];
long long ps[N];
bool used[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  int n, X, Y;
  cin >> n >> X >> Y;
  for (int i = 0, x; i < n; ++i) {
    cin >> x;
    cnt[x]++, ps[x] += x;
  }
  for (int i = 1; i < N; ++i) {
    cnt[i] += cnt[i - 1], ps[i] += ps[i - 1];
  }
  long long ans = LONG_LONG_MAX;
  for (int i = 2; i < N; ++i) {
    if (used[i]) continue;
    int k = X / Y;
    k = min(k, i - 1);
    long long cur = 0;
    for (int j = i; j < N; j += i) {
      used[j] = 1;
      cur += (long long)X * (cnt[j - k - 1] - cnt[j - i]);
      cur += (long long)Y * ((long long)(cnt[j] - cnt[j - k - 1]) * j -
                             (ps[j] - ps[j - k - 1]));
    }
    ans = min(ans, cur);
  }
  cout << ans;
  return 0;
}
