#include <bits/stdc++.h>
using namespace std;
long long a[4569844], c[4569844], s[4569844];
signed main() {
  long long n, x, y;
  cin >> n >> x >> y;
  long long maxxs = 0;
  for (register long long i = 1; i <= n; i++)
    cin >> a[i], maxxs = max(maxxs, a[i]), c[a[i]]++, s[a[i]] += a[i];
  if (maxxs == 1) {
    cout << n * min(x, y);
    return 0;
  }
  for (register long long i = 1; i <= maxxs * 2; i++)
    s[i] += s[i - 1], c[i] += c[i - 1];
  long long cha = ceil((double)(x / y) + 0.5), ans = 5e18;
  for (register long long i = 2; i <= maxxs; i++) {
    long long now = 0;
    for (register long long j = i; j <= maxxs + i; j += i) {
      long long l = j - i + 1, r = j;
      long long gcd = r - cha;
      if (gcd >= l)
        now += x * (c[gcd] - c[l - 1]);
      else
        gcd = l - 1;
      now += y * (r * (c[r] - c[gcd]) - (s[r] - s[gcd]));
    }
    ans = min(ans, now);
  }
  cout << ans;
  return 0;
}
