Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.

Arpa can perform two types of operations:

  * Choose a number and delete it with cost x. 
  * Choose a number and increase it by 1 with cost y. 



Arpa can apply these operations to as many numbers as he wishes, and he is allowed to apply the second operation arbitrarily many times on the same number.

Help Arpa to find the minimum possible cost to make the list good.

Input

First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y.

Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list.

Output

Print a single integer: the minimum possible cost to make the list good.

Examples

Input

4 23 17
1 17 17 16


Output

40


Input

10 6 2
100 49 71 73 66 96 8 60 41 63


Output

10

Note

In example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).

A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd [here](https://en.wikipedia.org/wiki/Greatest_common_divisor).
import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class b implements Runnable {
    PrintWriter out;
    int M, n;
    int[] arr;
    long x, y, counts[], sums[];
    public void main() throws Throwable {
        FastScanner in = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        M = 1000100;
        n = in.nextInt();
        x = in.nextLong();
        y = in.nextLong();
        
        arr = new int[n];
        for (int i = 0; i < n; i++) arr[i] = in.nextInt();
        
        counts = new long[M];
        sums = new long[M];
        for (int a : arr) {
            counts[a]++;
            sums[a] += a;
        }
        for (int i = 1; i < M; i++) {
            counts[i] += counts[i - 1];
            sums[i] += sums[i - 1];
        }
        int[] primes = primeSieve(M);
        long min = x * n;
        for (int p = 2; p < M; p++) {
            if (primes[p] != p) continue;
            long cost = 0;
            int ca = (int) (x / y);
            for (int s = 1; s <= 1000000; s += p) {
                int b = s + p - 2;
                int cut = s + p - 2 - ca;
                if (cut < s) cut = s - 1;
                cost += x * getCount(s, cut);
                cost += y * (getCount(cut + 1, b) * (s + p - 1) - getSum(cut + 1, b));
            }
            min = Math.min(min, cost);
        }
        out.println(min);
        out.close();
    }
 // Linear prime sieve, but forces you to save the smallest prime factors (more memory)
 // Useful when you need to factor numbers in a large range, but not all of them (like the above function)
 static int[] primeSieve(int N) {
     int[] lp = new int[N + 1];
     int[] pr = new int[N + 1]; // could shrink this to the number of primes
     int prSize = 0;
     for (int i = 2; i <= N; ++i) {
         if (lp[i] == 0) {
             lp[i] = i;
             pr[prSize++] = i;
         }
         int ub = Math.min(lp[i], N / i);
         for (int j = 0; j < prSize && pr[j] <= ub; ++j) {
             lp[i * pr[j]] = pr[j];
         }
     }
     return lp;
 }
    long getSum(int a, int b) {
        a = Math.max(a, 1);
        b = Math.min(b, sums.length - 1);
        if (a > b) return 0;
        return sums[b] - sums[a - 1];
    }
    long getCount(int a, int b) {
        a = Math.max(a, 1);
        b = Math.min(b, counts.length - 1);
        if (a > b) return 0;
        return counts[b] - counts[a - 1];
    }

    
    
    
    
    
    
    
    
    
    
    
    public static void main(String[] args) throws Exception {
        new Thread(null, new b(), "b", 1L << 29).start();
    }
    public void run() {
        try {
           main(); 
        } catch (Throwable t) {
            t.printStackTrace();
            System.exit(-1);
        }
    }
    static void sort(int[] arr) {
        Random rand = new Random();
        int n = arr.length;
        for (int i = 1; i < n; i++) {
            int j = rand.nextInt(i);
            int tmp = arr[i];
            arr[i] = arr[j];
            arr[j] = tmp;
        }
        Arrays.sort(arr);
    }
    static void sort(long[] arr) {
        Random rand = new Random();
        int n = arr.length;
        for (int i = 0; i < n; i++) {
            int j = rand.nextInt(i);
            long tmp = arr[i];
            arr[i] = arr[j];
            arr[j] = tmp;
        }
        Arrays.sort(arr);
    }
    static void sort(double[] arr) {
        Random rand = new Random();
        int n = arr.length;
        for (int i = 0; i < n; i++) {
            int j = rand.nextInt(i);
            double tmp = arr[i];
            arr[i] = arr[j];
            arr[j] = tmp;
        }
        Arrays.sort(arr);
    }
    static class FastScanner {
        BufferedReader br; StringTokenizer st;
        public FastScanner(InputStream i) {
            br = new BufferedReader(new InputStreamReader(i));
            st = new StringTokenizer("");
        }
        public String next() throws Exception {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }
        public int nextInt() throws Exception {
            return Integer.parseInt(next());
        }
        public double nextDouble() throws Exception {
            return Double.parseDouble(next());
        }
        public long nextLong() throws Exception {
            return Long.parseLong(next());
        }
        public int[] nextIntArr(int n) throws Exception {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) arr[i] = nextInt();
            return arr;
        }
        public double[] nextDoubleArr(int n) throws Exception {
            double[] arr = new double[n];
            for (int i = 0; i < n; i++) arr[i] = nextDouble();
            return arr;
        }
        public long[] nextLongArr(int n) throws Exception {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) arr[i] = nextLong();
            return arr;
        }
        public int[] nextOffsetIntArr(int n) throws Exception {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) arr[i] = nextInt() - 1;
            return arr;
        }
        
        public int[][] nextIntArr(int n, int m) throws Exception {
            int[][] arr = new int[n][m];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    arr[i][j] = nextInt();
            return arr;
        }
        public double[][] nextDoubleArr(int n, int m) throws Exception {
            double[][] arr = new double[n][m];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    arr[i][j] = nextDouble();
            return arr;
        }
        public long[][] nextLongArr(int n, int m) throws Exception {
            long[][] arr = new long[n][m];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    arr[i][j] = nextLong();
            return arr;
        }
    }
}