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.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/*
public class _851D {

}

*/

public class _851D
{
  static class Reader
  {
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader()
    {
      din = new DataInputStream(System.in);
      buffer = new byte[BUFFER_SIZE];
      bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException
    {
      din = new DataInputStream(new FileInputStream(file_name));
      buffer = new byte[BUFFER_SIZE];
      bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException
    {
      byte[] buf = new byte[64]; // line length
      int cnt = 0, c;
      while ((c = read()) != -1)
      {
        if (c == '\n')
          break;
        buf[cnt++] = (byte) c;
      }
      return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException
    {
      int ret = 0;
      byte c = read();
      while (c <= ' ')
        c = read();
      boolean neg = (c == '-');
      if (neg)
        c = read();
      do
      {
        ret = ret * 10 + c - '0';
      } while ((c = read()) >= '0' && c <= '9');

      if (neg)
        return -ret;
      return ret;
    }

    public long nextLong() throws IOException
    {
      long ret = 0;
      byte c = read();
      while (c <= ' ')
        c = read();
      boolean neg = (c == '-');
      if (neg)
        c = read();
      do {
        ret = ret * 10 + c - '0';
      } while ((c = read()) >= '0' && c <= '9');
      if (neg)
        return -ret;
      return ret;
    }

    public double nextDouble() throws IOException
    {
      double ret = 0, div = 1;
      byte c = read();
      while (c <= ' ')
        c = read();
      boolean neg = (c == '-');
      if (neg)
        c = read();

      do {
        ret = ret * 10 + c - '0';
      } while ((c = read()) >= '0' && c <= '9');

      if (c == '.')
      {
        while ((c = read()) >= '0' && c <= '9')
        {
          ret += (c - '0') / (div *= 10);
        }
      }

      if (neg)
        return -ret;
      return ret;
    }

    private void fillBuffer() throws IOException
    {
      bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
      if (bytesRead == -1)
        buffer[0] = -1;
    }

    private byte read() throws IOException
    {
      if (bufferPointer == bytesRead)
        fillBuffer();
      return buffer[bufferPointer++];
    }

    public void close() throws IOException
    {
      if (din == null)
        return;
      din.close();
    }
  }

  long sum(long[] apcc, long[] apc, int l, int r)
  {
    if (l > 0)
    {
      return apcc[r] - apcc[l - 1] - ((long) r - l + 1) * apc[l - 1];
    }
    else
    {
      return apcc[r];
    }
  }

  public void solve() throws Throwable
  {
    // actual solution
    Reader r = new Reader();

    long n = r.nextInt();

    long x = r.nextInt();

    long y = r.nextInt();

    int[] a = new int[(int) n];

    int[] ap = new int[2000001];
    long[] apc = new long[2000001];
    long[] apcc = new long[2000001];

    for (int i = 0; i < n; i++)
    {
      a[i] = r.nextInt();
      ap[a[i]]++;
    }

    apc[0] = ap[0];
    apcc[0] = apc[0];

    for (int i = 1; i <= 2000000; i++)
    {
      apc[i] = apc[i - 1] + ap[i];
      apcc[i] = apc[i] + apcc[i - 1];
    }

    boolean[] p = new boolean[2000001];

    for (int i = 0; i <= 2000000; i++)
    {
      p[i] = true;
    }

    int yr = (int) (x / y);

    long cost = Math.min(n * x, n * y);

    for (int i = 2; i <= 1000000; i++)
    {
      long tc = 0;
      if (p[i])
      {
        if (i - yr <= 1)
        {
          tc += sum(apcc, apc, 1, i - 1) * y;
        }
        else
        {
          if (yr > 0)
            tc += sum(apcc, apc, i - yr, i - 1) * y;
          tc += (apc[i - yr - 1]) * x;
        }
        int max = (1000000 + i - 1) / i;
        max *= i;
        for (int j = 2; j * i <= max; j++)
        {
          if (j * i - yr <= (j - 1) * i + 1)
          {
            tc += sum(apcc, apc, (j - 1) * i + 1, j * i - 1) * y;
          }
          else
          {
            if (yr > 0)
              tc += sum(apcc, apc, j * i - yr, j * i - 1) * y;
            tc += (apc[j * i - yr - 1] - apc[(j - 1) * i]) * x;
          }
          p[j * i] = false;
        }

        cost = Math.min(tc, cost);
      }
    }

    System.out.println(cost);
    // end here
  }

  public static void main(String[] args) throws Throwable
  {
    (new _851D()).solve();
  }

  class InputHelper
  {
    StringTokenizer tokenizer = null;
    private BufferedReader bufferedReader;

    public InputHelper(InputStream inputStream)
    {
      InputStreamReader inputStreamReader = new InputStreamReader(
          inputStream);
      bufferedReader = new BufferedReader(inputStreamReader, 16384);
    }

    public String read()
    {
      while (tokenizer == null || !tokenizer.hasMoreTokens())
      {
        try
        {
          String line = bufferedReader.readLine();
          if (line == null)
          {
            return null;
          }
          tokenizer = new StringTokenizer(line);
        } catch (IOException e)
        {
          e.printStackTrace();
        }
      }

      return tokenizer.nextToken();
    }

    public Integer readInteger()
    {
      return Integer.parseInt(read());
    }

    public Long readLong()
    {
      return Long.parseLong(read());
    }
  }
}
