1380_D. Berserk And Fireball_6356
There are n warriors in a row. The power of the i-th warrior is a_i. All powers are pairwise distinct.

You have two types of spells which you may cast: 

  1. Fireball: you spend x mana and destroy exactly k consecutive warriors; 
  2. Berserk: you spend y mana, choose two consecutive warriors, and the warrior with greater power destroys the warrior with smaller power. 



For example, let the powers of warriors be [2, 3, 7, 8, 11, 5, 4], and k = 3. If you cast Berserk on warriors with powers 8 and 11, the resulting sequence of powers becomes [2, 3, 7, 11, 5, 4]. Then, for example, if you cast Fireball on consecutive warriors with powers [7, 11, 5], the resulting sequence of powers becomes [2, 3, 4].

You want to turn the current sequence of warriors powers a_1, a_2, ..., a_n into b_1, b_2, ..., b_m. Calculate the minimum amount of mana you need to spend on it.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 2 ⋅ 10^5) — the length of sequence a and the length of sequence b respectively.

The second line contains three integers x, k, y (1 ≤ x, y, ≤ 10^9; 1 ≤ k ≤ n) — the cost of fireball, the range of fireball and the cost of berserk respectively.

The third line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ n). It is guaranteed that all integers a_i are pairwise distinct.

The fourth line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ n). It is guaranteed that all integers b_i are pairwise distinct.

Output

Print the minimum amount of mana for turning the sequnce a_1, a_2, ..., a_n into b_1, b_2, ..., b_m, or -1 if it is impossible.

Examples

Input


5 2
5 2 3
3 1 4 5 2
3 5


Output


8


Input


4 4
5 1 4
4 3 1 2
2 4 3 1


Output


-1


Input


4 4
2 1 11
1 3 2 4
1 3 2 4


Output


0
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

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

    static class TaskD
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt();
            int M = in.nextInt();
            long F = in.nextLong();
            int K = in.nextInt();
            long B = in.nextLong();

            int W[] = CPUtils.readIntArray(N, in);
            int O[] = CPUtils.readIntArray(M, in);

            Wrap[] WW = new Wrap[W.length];
            int j = 0;
            List<Integer> o_indices = new ArrayList<>();
            for (int i = 0; i < W.length; i++)
            {
                if (j < M && W[i] == O[j])
                {
                    WW[i] = new Wrap(W[i], true);
                    j++;
                    o_indices.add(i);
                } else
                {
                    WW[i] = new Wrap(W[i], false);
                }
            }
            if (j != M)
            {
                out.println(-1);
                return;
            }
            try
            {
                out.println(process(o_indices, O, WW, F, K, B));
            } catch (Exception e)
            {
                out.println(-1);
            }
        }

        private long process(List<Integer> O_INDICES, int[] O, Wrap[] WW, long F, int K, long B) throws Exception
        {
            O_INDICES.add(0, 0);
            O_INDICES.add(WW.length - 1);
            long cost = 0;
            for (int i = 0; i < O_INDICES.size() - 1; i++)
            {
                cost += process(O_INDICES.get(i), O_INDICES.get(i + 1), O, WW, F, K, B);
            }
            return cost;
        }

        private long process(int start, int end, int[] O, Wrap[] WW, long F, int K, long B) throws Exception
        {
            if (start >= end) return 0;
            if (WW[start].keep && WW[end].keep && start + 1 == end) return 0;

            int MAX = max(start, end, WW);
            int extra = 1;

            if ((MAX == WW[start].value && WW[start].keep) || (MAX == WW[end].value && WW[end].keep)) extra = 0;

            int len = (end - start + 1);
            len -= WW[start].keep ? 1 : 0;
            len -= WW[end].keep ? 1 : 0;

            if (extra == 1 && K > len) throw new Exception();

            if (extra == 0)
                return Math.min((len / K) * F + (len % K) * B, len * B);
            else
            {
                long min = (len / K) * F + (len % K) * B;
                len -= K;
                long min2 = F + len * B;
                return Math.min(min, min2);
            }
        }

        private int max(int start, int end, Wrap[] ww)
        {
            int max = Integer.MIN_VALUE;
            for (int i = start; i <= end; i++)
            {
                max = Math.max(max, ww[i].value);
            }
            return max;
        }

    }

    static class Wrap
    {
        int value;
        boolean keep;

        Wrap(int value, boolean keep)
        {
            this.value = value;
            this.keep = keep;
        }

    }

    static class CPUtils
    {
        public static int[] readIntArray(int size, Scanner in)
        {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
            {
                array[i] = in.nextInt();
            }
            return array;
        }

    }
}

