#include <bits/stdc++.h>
using namespace std;
long long n, x, y, Min, Max, ans, l, r, k;
long long a[5000010], t[5000010], s[5000010];
signed main() {
  cin >> n >> x >> y;
  for (long long i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    t[a[i]]++;
    s[a[i]] += a[i];
    Max = max(Max, a[i]);
  }
  if (Max == 1) {
    cout << n * min(x, y);
    return 0;
  }
  for (long long i = 2; i <= Max * 2; i++) {
    t[i] += t[i - 1];
    s[i] += s[i - 1];
  }
  Min = 2e16;
  for (long long i = 2; i <= Max; i++) {
    ans = 0;
    for (long long j = i; j <= Max + i; j += i) {
      l = j - i + 1;
      r = j;
      k = r - (long)(ceil(1.0 * x / y) + 0.5);
      if (k >= l)
        ans += x * (t[k] - t[l - 1]);
      else
        k = l - 1;
      ans += y * ((t[r] - t[k]) * r - (s[r] - s[k]));
    }
    Min = min(Min, ans);
  }
  cout << Min;
  return 0;
}
