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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sandip_Jana
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        final int N = (int) 1e6 + 1;
        final int M = (int) 2e6 + 1;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int x = in.nextInt();
            int y = in.nextInt();
            int a[] = new int[n + 1];

            int cnt[] = new int[M];
            long sum[] = new long[M];
            for (int i = 1; i <= n; i++) {
                a[i] = in.nextInt();
                cnt[a[i]] = cnt[a[i]] + 1;
                sum[a[i]] = sum[a[i]] + a[i];
            }
            for (int i = 1; i < M; i++) {
                cnt[i] += cnt[i - 1];
                sum[i] += sum[i - 1];
            }
            long ans = Long.MAX_VALUE;
            for (int gcd = 2; gcd < N; gcd++) {
                long result = 0;
                int prev = 0;
                for (int j = gcd; j < M; j += gcd) {
                    int f = Math.max(j - (int) Math.min(j, x / y), prev + 1);
                    long numberofdeletions = 0;

                    if (f > 0)
                        numberofdeletions += (cnt[f - 1] - cnt[prev]);
                    long costofdeletion = 0;
                    if (numberofdeletions > 0)
                        costofdeletion = (numberofdeletions * 1L * x);

                    long increase = 0;
                    long countofele = 0;
                    if (f > 0) {
                        increase = sum[j - 1] - sum[f - 1];
                        countofele = cnt[j - 1] - cnt[f - 1];
                    }

                    long costofincrease = 0;
                    if (countofele > 0)
                        costofincrease = ((j * 1L * countofele) - increase) * 1L * y;

                    prev = j;
                    result = result + (costofdeletion + costofincrease);
                }

                ans = Math.min(ans, result);
            }
            out.println(ans);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }
}

