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.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 * @author pttrung
 */
public class B_Round_432_Div1 {

    public static long MOD = 1000000007;

    public static void main(String[] args) throws FileNotFoundException {
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File(
        // "output.txt")));
        PrintWriter out = new PrintWriter(System.out);
        Scanner in = new Scanner();
        int n = in.nextInt();
        long x = in.nextInt();
        long y = in.nextInt();

        int[] count = new int[1000001];
        int[] data = new int[n];

        for (int i = 0; i < n; i++) {
            data[i] = in.nextInt();
            count[data[i]]++;
        }
        Arrays.sort(data);
        long re = ((long) (n - 1)) * x;
        if (data[n - 1] == 1) {
            re = Long.min(((long) n * y), (long) (n - 1) * x + y);
        }
        boolean[] check = new boolean[count.length];
        int[] total = new int[count.length];
        ArrayList<Integer> set = new ArrayList();
        for (int i = 2; i < check.length; i++) {
            if (!check[i]) {
                total[i] += count[i];
                for (int j = i + i; j < check.length; j += i) {
                    check[j] = true;
                    total[i] += count[j];
                }
                //if (total[i] > 0) {
                set.add(i);
                // }
            }
        }

        //System.out.println(Arrays.toString(data));
        for (int i = 2; i < total.length; i++) {
            int left = n - total[i];
            re = Long.min(left * x, re);
        }
        if (x > y) {

            long[] pre = new long[n];
            for (int i = 0; i < n; i++) {
                pre[i] = (long) data[i] + (i > 0 ? pre[i - 1] : 0);
            }

            for (int i : set) {
                int nxt = 0;
                long cur = 0;
                int index;
                int other;
                for (int j = i; j - i <= data[n - 1] && nxt < n; j += i) {
                    int st = nxt;
                    int ed = n - 1;
                    index = nxt;
                    while (st <= ed) {
                        int mid = (st + ed) / 2;
                        if (data[mid] >= j) {
                            index = mid;
                            ed = mid - 1;
                        } else {
                            st = mid + 1;
                        }
                    }
                    if (data[n - 1] < j) {
                        index = n;
                    }
                    st = nxt;
                    ed = index - 1;
                    other = -1;
                    while (st <= ed) {
                        int mid = (st + ed) / 2;
                        long v = (i - (data[mid] % i)) * y;
                        if (v >= x) {
                            other = mid;
                            st = mid + 1;
                        } else {
                            ed = mid - 1;
                        }
                    }
                    if (other != -1) {
                        cur += (other - nxt + 1) * x;
                        long left = index - other - 1;
                        long sum = pre[index - 1] - pre[other];
                        cur += ((long) j * left - sum) * y;
                    } else if (index != nxt) {
                        long tmp = (long) (index - nxt);
                        tmp *= (long) j;
                        cur += (tmp - (pre[index - 1] - (nxt != 0 ? pre[nxt - 1] : 0))) * y;
                    }
                    //System.out.println(Arrays.toString(data));
                    //System.out.println(j + " " + index + " " + other + " " + nxt + " " + cur);
                    st = index;
                    ed = n - 1;
                    nxt = index;
                    while (st <= ed) {
                        int mid = (st + ed) / 2;
                        if (data[mid] <= j) {
                            nxt = mid + 1;
                            st = mid + 1;
                        } else {
                            ed = mid - 1;
                        }
                    }
                }

                re = Long.min(re, cur);

            }
        }
        out.println(re);
        out.close();
    }

    public static int[] KMP(String val) {
        int i = 0;
        int j = -1;
        int[] result = new int[val.length() + 1];
        result[0] = -1;
        while (i < val.length()) {
            while (j >= 0 && val.charAt(j) != val.charAt(i)) {
                j = result[j];
            }
            j++;
            i++;
            result[i] = j;
        }
        return result;

    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;
    }

    public static int digit(long n) {
        int result = 0;
        while (n > 0) {
            n /= 10;
            result++;
        }
        return result;
    }

    public static double dist(long a, long b, long x, long y) {
        double val = (b - a) * (b - a) + (x - y) * (x - y);
        val = Math.sqrt(val);
        double other = x * x + a * a;
        other = Math.sqrt(other);
        return val + other;

    }

    public static class Point implements Comparable<Point> {

        int x, y;

        public Point(int start, int end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = 47 * hash + this.x;
            hash = 47 * hash + this.y;
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return Integer.compare(x, o.x);
        }
    }

    public static class FT {

        long[] data;

        FT(int n) {
            data = new long[n];
        }

        public void update(int index, long value) {
            while (index < data.length) {
                data[index] += value;
                index += (index & (-index));
            }
        }

        public long get(int index) {
            long result = 0;
            while (index > 0) {
                result += data[index];
                index -= (index & (-index));
            }
            return result;

        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static long pow(long a, long b, long MOD) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long val = pow(a, b / 2, MOD);
        if (b % 2 == 0) {
            return val * val % MOD;
        } else {
            return val * (val * a % MOD) % MOD;

        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //  br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}
