//package EduRound91;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;

/**
 * @author sguar <shugangcao@gmail.com>
 * strive for greatness
 * Created on 2020-01-10
 */
public class D {
    InputStream is;
    PrintWriter out;
    private static final String INPUT_FILE_NAME = "/Users/sguar/IdeaProjects/kotlinLearn/src/input.txt";

    void solve() {

        int n = ni();
        int m = ni();
        int x = ni();
        int k = ni();
        int y = ni();
        int[] a = na(n);
        int[] b = na(m);

        int j = 0;
        int last = 0;
        List<Pair> list = new ArrayList<>();

        int distinct = 0;

        for (int i = 0; i < n; i++) {
            if (j < m && a[i] == b[j]) {
                if (i > last) {
                    distinct += i - last;
                    list.add(new Pair(last, i - 1));
                }
                j++;
                last = i + 1;
            }
        }

        if (last < n) {
            distinct += n - last;
            list.add(new Pair(last, n - 1));
        }

        debug(list);

        if (distinct + m != n) {
            out.println(-1);
        } else if (distinct == 0) {
            out.println(0);
        } else {
            boolean ans = true;
            long sum = 0;
            for (Pair p : list) {
                if (!ans) {
                    break;
                }
                int len = p.y - p.x + 1;
                debug("len", len);
                if (len >= k) {
                    boolean ok = true;

                    for (int i = p.x; i <= p.y && ok; i++) {
                        boolean ok1 = p.x > 0 && a[i] < a[p.x - 1];
                        boolean ok2 = p.y + 1 < n && a[i] < a[p.y + 1];
                        ok = ok1 || ok2;
                    }

                    if ((long) y * k < x) {
                        if ((len % k) > 0 || ok) {
                            sum += (long) len * y;
                        } else {
                            sum += (long) (len - k) * y + x;
                        }
                    } else {
                        sum += (long) (len / k) * x + (long) (len % k) * y;
                    }

                } else {
                    for (int i = p.x; i <= p.y && ans; i++) {
                        boolean ok1 = p.x > 0 && a[i] < a[p.x - 1];
                        boolean ok2 = p.y + 1 < n && a[i] < a[p.y + 1];
                        ans = ok1 || ok2;
                        sum += (long) len * y;
                    }
                }
            }
            if (ans) {
                out.println(sum);
            } else {
                out.println(-1);
            }
        }
    }

    class Pair {
        int x;
        int y;

        Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "x: " + x + ", y: " + y;
        }
    }

    public static long invl(long a, long mod) {
        long b = mod;
        long p = 1, q = 0;
        while (b > 0) {
            long c = a / b;
            long d;
            d = a;
            a = b;
            b = d % b;
            d = p;
            p = q;
            q = d - c * q;
        }
        return p < 0 ? p + mod : p;
    }

    void run() throws Exception {

        is = oj ? System.in : new FileInputStream(INPUT_FILE_NAME);
        out = new PrintWriter(System.out);

        long s = System.currentTimeMillis();
        solve();
        out.flush();
        debug(System.currentTimeMillis() - s + "ms");
    }

    public static void main(String[] args) throws Exception {
        new D().run();
    }

    private byte[] inbuf = new byte[1024];
    int lenbuf = 0;
    int ptrbuf = 0;

    private int readByte() {
        if (lenbuf == -1) throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

    private void debug(Object... o) {
        if (!oj) System.out.println(Arrays.deepToString(o));
    }

    private void debug(Object a, Object o) {
        if (!oj) {
            System.out.println(a.toString() + ": " + o.toString());
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.BitSet;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class DBerserkAndFireball {
        long x;
        long y;
        int k;
        int[] a;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            x = in.nextLong();
            k = in.nextInt();
            y = in.nextLong();
            a = in.readIntArray(n);
            int[] b = in.readIntArray(m);

            BitSet delete = new BitSet();
            delete.set(0, n);
            for (int j = 0, i = 0; j < m; j++, i++) {
                while (i < n && a[i] != b[j]) {
                    i++;
                }
                if (i == n) {
                    out.println(-1);
                    return;
                }
                delete.clear(i);
            }

            if (delete.isEmpty()) {
                out.println(0);
                return;
            }

            long answer = 0;
            for (int i = 0, j = 0; i < n; i = j) {
                while (j < n && delete.get(i) == delete.get(j))
                    j++;

                if (delete.get(i)) {
                    long cost = cost(i, j);
                    if (cost == -1) {
                        out.println(-1);
                        return;
                    }
                    answer += cost;
                }
            }

            out.println(answer);
        }

        private long cost(int l, int r) {
            int max = 0;
            for (int i = l; i < r; i++) {
                max = Math.max(max, a[i]);
            }
            if (l - 1 >= 0)
                max = Math.max(max, a[l - 1]);
            if (r < a.length)
                max = Math.max(max, a[r]);

            int count = r - l;

            int small = 0;
            for (int i = l; i < r; i++) {
                if (a[i] < max)
                    small++;
            }

            long answer = 0;
            if (x < y * k) {
                answer += x * (count / k);
                count %= k;

                if (small >= count) {
                    answer += count * y;
                } else {
                    return -1;
                }
            } else {
                if (small >= count) {
                    answer += count * y;
                } else {
                    long blocks = ((count - small) + (k - 1)) / k;
                    if (blocks * k > count) {
                        return -1;
                    }
                    answer += blocks * x;
                    answer += (count - blocks * k) * y;
                }
            }
            return answer;
        }

    }

    static class InputReader {
        public final BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

        public int[] readIntArray(int n) {
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = nextInt();
            }
            return x;
        }

    }
}


import java.util.*;
import java.io.*;
public class MainClass
{
    static ST ST;
    static long x;
    static int k;
    static long y;
    public static void main(String[] args) throws IOException
    {
        Reader in = new Reader();
        int n = in.nextInt();
        int m = in.nextInt();
        x = in.nextLong();
        k = in.nextInt();
        y = in.nextLong();
        int[] A = new int[n];
        int[] index = new int[n];
        int[] B = new int[m];
        for (int i=0;i<n;i++)
        {
            A[i] = in.nextInt() - 1;
            index[A[i]] = i;
        }
        int[] mark = new int[m];
        Arrays.fill(mark, -1);
        for (int i=0;i<m;i++)
        {
            B[i] = in.nextInt() - 1;
            mark[i] = index[B[i]];
        }
        ST = new ST();
        ST.createST(A);
        long ans = 0L;
        boolean ff = true;
        for (int i=0;i<m - 1;i++)
        {
            int diff = mark[i + 1] - mark[i] - 1;
            if (diff == 0)
                continue;
            if (diff < 0 || mark[i] == -1 || mark[i + 1] == -1)
            {
                ff = false;
                break;
            }
            int min = ST.queryST(mark[i] + 1, mark[i + 1] - 1, 0, n - 1, 0);
            int max = Math.max(B[i], B[i + 1]);
            long ret = solve(diff, min, max);
            if (ret == Long.MAX_VALUE)
            {
                ff = false;
                break;
            }
            ans += ret;
        }
        if (ff)
        {
            boolean fff = true;
            if (mark[0] != 0)
            {
                int min = ST.queryST(0, mark[0] - 1, 0, n - 1, 0);
                long ret = solve(mark[0], min, B[0]);
                if (ret == Long.MAX_VALUE)
                    fff = false;
                ans += ret;
            }
            if (mark[m - 1] != n - 1)
            {
                int min = ST.queryST(mark[m - 1] + 1, n - 1, 0, n - 1, 0);
                long ret = solve(n - mark[m - 1] - 1, min, B[m - 1]);
                if (ret == Long.MAX_VALUE)
                    fff = false;
                ans += ret;
            }
            if (!fff)
            {
                System.out.println(-1);
            }
            else
                System.out.println(ans);
        }
        else
            System.out.println(-1);
    }
    public static long solve(int len, int min, int max)
    {
        if (len == 0)
            return 0L;
        long ans = Long.MAX_VALUE;
        if (min < max)
        {
            ans = len * y;
        }
        long ans1 = Long.MAX_VALUE;
        if (len >= k)
        {
            ans1 = x;
            len -= k;
            long ans2 = 0L;
            if (k * y < x)
                ans2 += len * y;
            else
                ans2 += (len / k) * x + (len % k) * y;
            ans1 += ans2;
        }
        return Math.min(ans, ans1);
    }
}
class ST
{
    int[] st;
    public int nextPowerOfTwo(int num)
    {
        if(num == 0)
            return 1;
        if(num > 0 && (num & (num - 1)) == 0)
            return num;
        while((num &(num - 1)) > 0)
        {
            num = num & (num - 1);
        }
        return num << 1;
    }

    public void createST(int[] A)
    {
        int np2 = nextPowerOfTwo(A.length);
        st = new int[2 * np2 - 1];
        Arrays.fill(st, Integer.MIN_VALUE);
        constructST(A, 0, A.length - 1, 0);
    }

    public void constructST(int[] A, int low, int high, int pos)
    {
        if (low == high)
        {
            st[pos] = A[low];
            return;
        }
        int mid = (low + high) / 2;
        constructST(A, low, mid, 2 * pos + 1);
        constructST(A, mid + 1, high, 2 * pos + 2);
        st[pos] = Math.max(st[2 * pos + 1], st[2 * pos + 2]);
    }

    public int queryST(int qlow, int qhigh, int low, int high, int pos)
    {
        if(qlow > high || qhigh < low)
        {
            return Integer.MIN_VALUE;
        }

        if(qlow <= low && qhigh >= high)
        {
            return st[pos];
        }

        int mid = (low+high)/2;
        return Math.max(queryST(qlow, qhigh, low, mid, 2 * pos + 1), queryST(qlow, qhigh, mid + 1, high, 2 * pos + 2));
    }

}
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();
    }
}


import java.util.*;
import java.io.*;
public class MainClass
{
    static ST ST;
    static long x;
    static int k;
    static long y;
    public static void main(String[] args) throws IOException
    {
        Reader in = new Reader();
        int n = in.nextInt();
        int m = in.nextInt();
        x = in.nextLong();
        k = in.nextInt();
        y = in.nextLong();
        int[] A = new int[n];
        int[] index = new int[n];
        int[] B = new int[m];
        for (int i=0;i<n;i++)
        {
            A[i] = in.nextInt() - 1;
            index[A[i]] = i;
        }
        int[] mark = new int[m];
        Arrays.fill(mark, -1);
        for (int i=0;i<m;i++)
        {
            B[i] = in.nextInt() - 1;
            mark[i] = index[B[i]];
        }
        ST = new ST();
        ST.createST(A);
        long ans = 0L;
        boolean ff = true;
        for (int i=0;i<m - 1;i++)
        {
            int diff = mark[i + 1] - mark[i] - 1;
            if (diff == 0)
                continue;
            if (diff < 0 || mark[i] == -1 || mark[i + 1] == -1)
            {
                ff = false;
                break;
            }
            int min = ST.queryST(mark[i] + 1, mark[i + 1] - 1, 0, n - 1, 0);
            int max = Math.max(B[i], B[i + 1]);
            long ret = solve(diff, min, max);
            if (ret == Long.MAX_VALUE)
            {
                ff = false;
                break;
            }
            ans += ret;
        }
        if (ff)
        {
            boolean fff = true;
            if (mark[0] != 0)
            {
                int min = ST.queryST(0, mark[0] - 1, 0, n - 1, 0);
                long ret = solve(mark[0], min, B[0]);
                if (ret == Long.MAX_VALUE)
                    fff = false;
                ans += ret;
            }
            if (mark[m - 1] != n - 1)
            {
                int min = ST.queryST(mark[m - 1] + 1, n - 1, 0, n - 1, 0);
                long ret = solve(n - mark[m - 1] - 1, min, B[m - 1]);
                if (ret == Long.MAX_VALUE)
                    fff = false;
                ans += ret;
            }
            if (!fff)
            {
                System.out.println(-1);
            }
            else
                System.out.println(ans);
        }
        else
            System.out.println(-1);
    }
    public static long solve(int len, int min, int max)
    {
        if (len == 0)
            return 0L;
        long ans = Long.MAX_VALUE;
        if (min < max)
        {
            ans = len * y;
        }
        long ans1 = Long.MAX_VALUE;
        if (len >= k)
        {
            ans1 = x;
            len -= k;
            ans1 += (len / k) * x + (len % k) * y;
        }
        return Math.min(ans, ans1);
    }
}
class ST
{
    int[] st;
    public int nextPowerOfTwo(int num)
    {
        if(num == 0)
            return 1;
        if(num > 0 && (num & (num - 1)) == 0)
            return num;
        while((num &(num - 1)) > 0)
        {
            num = num & (num - 1);
        }
        return num << 1;
    }

    public void createST(int[] A)
    {
        int np2 = nextPowerOfTwo(A.length);
        st = new int[2 * np2 - 1];
        Arrays.fill(st, Integer.MIN_VALUE);
        constructST(A, 0, A.length - 1, 0);
    }

    public void constructST(int[] A, int low, int high, int pos)
    {
        if (low == high)
        {
            st[pos] = A[low];
            return;
        }
        int mid = (low + high) / 2;
        constructST(A, low, mid, 2 * pos + 1);
        constructST(A, mid + 1, high, 2 * pos + 2);
        st[pos] = Math.max(st[2 * pos + 1], st[2 * pos + 2]);
    }

    public int queryST(int qlow, int qhigh, int low, int high, int pos)
    {
        if(qlow > high || qhigh < low)
        {
            return Integer.MIN_VALUE;
        }

        if(qlow <= low && qhigh >= high)
        {
            return st[pos];
        }

        int mid = (low+high)/2;
        return Math.max(queryST(qlow, qhigh, low, mid, 2 * pos + 1), queryST(qlow, qhigh, mid + 1, high, 2 * pos + 2));
    }

}
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();
    }
}


import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class A {

	static int mod = (int) 1e9 + 7;

	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int t = 1;// sc.nextInt();

		while (t-- > 0) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			long x = sc.nextInt();
			long k = sc.nextInt();
			long y = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[m];
			HashMap<Integer, Integer> hm = new HashMap<>();
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				hm.put(a[i], i);
			}
			int[] al = new int[m];
			for (int i = 0; i < m; i++) {
				b[i] = sc.nextInt();

				al[i] = hm.get(b[i]);

			}

			int l = 0, lval = 0, rval = 0, r = 0;
			boolean ok = true;
			long ans = 0;
			for (int i = 0; i < m; i++) {
				if (i == 0) {
					l = -1;
					lval = -1;
					r = hm.get(b[i]);
					rval = a[r];
				} else {
					l = hm.get(b[i - 1]);
					r = hm.get(b[i]);
					lval = a[l];
					rval = a[r];
				}

				if (r < l) {
					ok = false;
					break;
				}
				long val = r - l - 1;
				int max = -1;
				for (int j = l + 1; j < r; j++) {
					max = Math.max(a[j], max);
				}
				if (val >= k) {
					if (k <= y * k) {
						ans += y * (val % k) + (val / k) * x;
					} else {
						if (max < lval || max < rval) {
							ans += val * y;
						} else {
							ans += x + (val - k) * y;
						}
					}
				}

				else {

					if (max < lval || max < rval) {
						ans += val * y;
					} else {
						ok = false;
						break;
					}

				}
			}

			if (ok && r < n - 1) {
				l=hm.get(b[m-1]);
				r = n;
				lval = a[l];
				rval = -1;
				int max = -1;
				int val = r - l - 1;
				for (int j = l + 1; j < r; j++) {
					max = Math.max(a[j], max);
				}
				if (val >= k) {
					if (k <= y * k) {
						ans += y * (val % k) + (val / k) * x;
					} else {
						if (max < lval || max < rval) {
							ans += val * y;
						} else {
							ans += x + (val - k) * y;
						}
					}
				}

				else {

					if (max < lval || max < rval) {
						ans += val * y;
					} else {
						ok = false;
						break;
					}

				}
			}

			out.append(ok==true?ans:-1);
			out.append("\n");

		}
		System.out.println(out);
	}

}


import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class A {

	static int mod = (int) 1e9 + 7;

	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int t = 1;// sc.nextInt();

		while (t-- > 0) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			int x = sc.nextInt();
			int k = sc.nextInt();
			int y = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[m];
			HashMap<Integer, Integer> hm = new HashMap<>();
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				hm.put(a[i], i);
			}
			int[] al = new int[m];
			for (int i = 0; i < m; i++) {
				b[i] = sc.nextInt();

				al[i] = hm.get(b[i]);

			}
			long ans = 0;
			boolean ok = true;

			int l = -1;
			int r = 0;
			if (x <= k * y) {

				for (int i = 0; i < m; i++) {

					r = al[i];
					if(r<l) {
						ok=false;
						break;
					}
					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (val >= k) {
						ans += (long)((val % k) * y + (val / k) * x);
					} else {
						if (l == -1) {
							if (a[r] > max) {
								ans +=(long)( val * y);
							} else {
								ok = false;
								break;
							}
						}

						else if (max < a[l] || max < a[r]) {
							ans += (long)(val * y);
						} else {
							ok = false;
							break;
						}

					}

					l = al[i];

				}

				if (ok && l < n - 1) {
					r = n;

					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (val >= k) {
						ans += (long)((val % k) * y + (val / k) * x);
					}

					else if (max < a[l]) {
						ans +=(long)( val * y);
					} else {
						ok = false;
						break;
					}

				}

			} else {

				for (int i = 0; i < m; i++) {

					if(r<l) {
						ok=false;
						break;
					}

					r = al[i];
					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (l == -1) {
						if (max < a[r]) {
							ans +=(long)( y * val);
						} else {
							ok = false;

							break;

						}
					}

					else if (max < a[l] || max < a[r]) {
						ans += (long)(y * val);
					} else {

						if (val >= k) {

							ans += (long)(x + (val - k) * y);

						} else {
							ok = false;
							break;
						}
					}

					l = al[i];

				}

				if(ok && l<n-1) {
					r=n;

					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (max < a[l]) {
						ans +=(long)( y * val);
					} else {

						if (val >= k) {

							ans +=(long)( x + (val - k) * y);

						} else {
							ok = false;
							break;
						}
					}
				}

			}

			out.append(ok == true ? ans : -1);
			out.append("\n");
		}
		System.out.println(out);
	}

}


import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class A {

	static int mod = (int) 1e9 + 7;

	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int t = 1;// sc.nextInt();

		while (t-- > 0) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			int x = sc.nextInt();
			int k = sc.nextInt();
			int y = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[m];
			HashMap<Integer, Integer> hm = new HashMap<>();
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				hm.put(a[i], i);
			}
			int[] al = new int[m];
			for (int i = 0; i < m; i++) {
				b[i] = sc.nextInt();

				al[i] = hm.get(b[i]);

			}
			int ans = 0;
			boolean ok = true;

			int l = -1;
			int r = 0;
			if (x <= k * y) {

				for (int i = 0; i < m; i++) {

					r = al[i];
					if(r<l) {
						ok=false;
						break;
					}
					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (val >= k) {
						ans += (val % k) * y + (val / k) * x;
					} else {
						if (l == -1) {
							if (a[r] > max) {
								ans += val * y;
							} else {
								ok = false;
								break;
							}
						}

						else if (max < a[l] || max < a[r]) {
							ans += val * y;
						} else {
							ok = false;
							break;
						}

					}

					l = al[i];

				}

				if (ok && l < n - 1) {
					r = n;

					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (val >= k) {
						ans += (val % k) * y + (val / k) * x;
					}

					else if (max < a[l]) {
						ans += val * y;
					} else {
						ok = false;
						break;
					}

				}

			} else {

				for (int i = 0; i < m; i++) {

					if(r<l) {
						ok=false;
						break;
					}

					r = al[i];
					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (l == -1) {
						if (max < a[r]) {
							ans += y * val;
						} else {
							ok = false;

							break;

						}
					}

					if (max < a[l] || max < a[r]) {
						ans += y * val;
					} else {

						if (val >= k) {

							ans += x + (val - k) * y;

						} else {
							ok = false;
							break;
						}
					}

					l = al[i];

				}

				if(ok && l<n-1) {
					r=n;

					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (max < a[l]) {
						ans += y * val;
					} else {

						if (val >= k) {

							ans += x + (val - k) * y;

						} else {
							ok = false;
							break;
						}
					}
				}

			}

			out.append(ok == true ? ans : -1);
			out.append("\n");
		}
		System.out.println(out);
	}

}


import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class A {

	static int mod = (int) 1e9 + 7;

	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int t = 1;// sc.nextInt();

		while (t-- > 0) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			long x = sc.nextInt();
			long k = sc.nextInt();
			long y = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[m];
			HashMap<Integer, Integer> hm = new HashMap<>();
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				hm.put(a[i], i);
			}
			int[] al = new int[m];
			for (int i = 0; i < m; i++) {
				b[i] = sc.nextInt();

				al[i] = hm.get(b[i]);

			}

			int l = 0, lval = 0, rval = 0, r = 0;
			boolean ok = true;
			long ans = 0;
			for (int i = 0; i < m; i++) {
				if (i == 0) {
					l = -1;
					lval = -1;
					r = hm.get(b[i]);
					rval = a[r];
				} else {
					l = hm.get(b[i - 1]);
					r = hm.get(b[i]);
					lval = a[l];
					rval = a[r];
				}

				if (r < l) {
					ok = false;
					break;
				}
				long val = r - l - 1;
				int max = -1;
				for (int j = l + 1; j < r; j++) {
					max = Math.max(a[j], max);
				}
				if (val >= k) {
					if (x <= y * k) {
						ans += y * (val % k) + (val / k) * x;
					} else {
						if (max < lval || max < rval) {
							ans += val * y;
						} else {
							ans += x + (val - k) * y;
						}
					}
				}

				else {

					if (max < lval || max < rval) {
						ans += val * y;
					} else {
						ok = false;
						break;
					}

				}
			}

			if (ok && r < n - 1) {
				l=hm.get(b[m-1]);
				r = n;
				lval = a[l];
				rval = -1;
				int max = -1;
				int val = r - l - 1;
				for (int j = l + 1; j < r; j++) {
					max = Math.max(a[j], max);
				}
				if (val >= k) {
					if (k <= y * k) {
						ans += y * (val % k) + (val / k) * x;
					} else {
						if (max < lval || max < rval) {
							ans += val * y;
						} else {
							ans += x + (val - k) * y;
						}
					}
				}

				else {

					if (max < lval || max < rval) {
						ans += val * y;
					} else {
						ok = false;
						break;
					}

				}
			}

			out.append(ok==true?ans:-1);
			out.append("\n");

		}
		System.out.println(out);
	}

}


import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class A {

	static int mod = (int) 1e9 + 7;

	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int t = 1;// sc.nextInt();

		while (t-- > 0) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			int x = sc.nextInt();
			int k = sc.nextInt();
			int y = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[m];
			HashMap<Integer, Integer> hm = new HashMap<>();
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				hm.put(a[i], i);
			}
			int[] al = new int[m];
			for (int i = 0; i < m; i++) {
				b[i] = sc.nextInt();

				al[i] = hm.get(b[i]);

			}
			int ans = 0;
			boolean ok = true;

			int l = -1;
			int r = 0;
			if (x <= k * y) {

				for (int i = 0; i < m; i++) {

					r = al[i];
					if(r<l) {
						ok=false;
						break;
					}
					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (val >= k) {
						ans += (val % k) * y + (val / k) * x;
					} else {
						if (l == -1) {
							if (a[r] > max) {
								ans += val * y;
							} else {
								ok = false;
								break;
							}
						}

						else if (max < a[l] || max < a[r]) {
							ans += val * y;
						} else {
							ok = false;
							break;
						}

					}

					l = al[i];

				}

				if (ok && l < n - 1) {
					r = n;

					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (val >= k) {
						ans += (val % k) * y + (val / k) * x;
					}

					else if (max < a[l]) {
						ans += val * y;
					} else {
						ok = false;
						break;
					}

				}

			} else {

				for (int i = 0; i < m; i++) {

					if(r<l) {
						ok=false;
						break;
					}

					r = al[i];
					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (l == -1) {
						if (max < a[r]) {
							ans += y * val;
						} else {
							ok = false;

							break;

						}
					}

					else if (max < a[l] || max < a[r]) {
						ans += y * val;
					} else {

						if (val >= k) {

							ans += x + (val - k) * y;

						} else {
							ok = false;
							break;
						}
					}

					l = al[i];

				}

				if(ok && l<n-1) {
					r=n;

					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (max < a[l]) {
						ans += y * val;
					} else {

						if (val >= k) {

							ans += x + (val - k) * y;

						} else {
							ok = false;
							break;
						}
					}
				}

			}

			out.append(ok == true ? ans : -1);
			out.append("\n");
		}
		System.out.println(out);
	}

}


import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class A {

	static int mod = (int) 1e9 + 7;

	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int t = 1;// sc.nextInt();

		while (t-- > 0) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			long x = sc.nextInt();
			long k = sc.nextInt();
			long y = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[m];
			HashMap<Integer, Integer> hm = new HashMap<>();
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				hm.put(a[i], i);
			}
			int[] al = new int[m];
			for (int i = 0; i < m; i++) {
				b[i] = sc.nextInt();

				al[i] = hm.get(b[i]);

			}
			long ans = 0;
			boolean ok = true;

			int l = -1;
			int r = 0;
			if (x <= k * y) {

				for (int i = 0; i < m; i++) {

					r = al[i];
					if(r<l) {
						ok=false;
						break;
					}
					int cmin = 0;
					int max = -1;
					long val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (val >= k) {
						ans += (long)((val % k) * y + (val / k) * x);
					} else {
						if (l == -1) {
							if (a[r] > max) {
								ans +=(long)( val * y);
							} else {
								ok = false;
								break;
							}
						}

						else if (max < a[l] || max < a[r]) {
							ans += (long)(val * y);
						} else {
							ok = false;
							break;
						}

					}

					l = al[i];

				}

				if (ok && l < n - 1) {
					r = n;

					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (val >= k) {
						ans += (long)((val % k) * y + (val / k) * x);
					}

					else if (max < a[l]) {
						ans +=(long)( val * y);
					} else {
						ok = false;
						break;
					}

				}

			} else {

				for (int i = 0; i < m; i++) {

					if(r<l) {
						ok=false;
						break;
					}

					r = al[i];
					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (l == -1) {
						if (max < a[r]) {
							ans +=(long)( y * val);
						} else {
							ok = false;

							break;

						}
					}

					else if (max < a[l] || max < a[r]) {
						ans += (long)(y * val);
					} else {

						if (val >= k) {

							ans += (long)(x + (val - k) * y);

						} else {
							ok = false;
							break;
						}
					}

					l = al[i];

				}

				if(ok && l<n-1) {
					r=n;

					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (max < a[l]) {
						ans +=(long)( y * val);
					} else {

						if (val >= k) {

							ans +=(long)( x + (val - k) * y);

						} else {
							ok = false;
							break;
						}
					}
				}

			}

			out.append(ok == true ? ans : -1);
			out.append("\n");
		}
		System.out.println(out);
	}

}


import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class A {

	static int mod = (int) 1e9 + 7;

	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int t = 1;// sc.nextInt();

		while (t-- > 0) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			long x = sc.nextInt();
			long k = sc.nextInt();
			long y = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[m];
			HashMap<Integer, Integer> hm = new HashMap<>();
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				hm.put(a[i], i);
			}
			int[] al = new int[m];
			for (int i = 0; i < m; i++) {
				b[i] = sc.nextInt();

				al[i] = hm.get(b[i]);

			}

			int l = 0, lval = 0, rval = 0, r = 0;
			boolean ok = true;
			long ans = 0;
			for (int i = 0; i < m; i++) {
				if (i == 0) {
					l = -1;
					lval = -1;
					r = hm.get(b[i]);
					rval = a[r];
				} else {
					l = hm.get(b[i - 1]);
					r = hm.get(b[i]);
					lval = a[l];
					rval = a[r];
				}

				if (r < l) {
					ok = false;
					break;
				}
				long val = r - l - 1;
				int max = -1;
				for (int j = l + 1; j < r; j++) {
					max = Math.max(a[j], max);
				}
				if (val >= k) {
					if (x <= y * k) {
						ans += y * (val % k) + (val / k) * x;
					} else {
						if (max < lval || max < rval) {
							ans += val * y;
						} else {
							ans += x + (val - k) * y;
						}
					}
				}

				else {

					if (max < lval || max < rval) {
						ans += val * y;
					} else {
						ok = false;
						break;
					}

				}
			}

			if (ok && r < n - 1) {
				l=hm.get(b[m-1]);
				r = n;
				lval = a[l];
				rval = -1;
				int max = -1;
				int val = r - l - 1;
				for (int j = l + 1; j < r; j++) {
					max = Math.max(a[j], max);
				}
				if (val >= k) {
					if (x <= y * k) {
						ans += y * (val % k) + (val / k) * x;
					} else {
						if (max < lval || max < rval) {
							ans += val * y;
						} else {
							ans += x + (val - k) * y;
						}
					}
				}

				else {

					if (max < lval || max < rval) {
						ans += val * y;
					} else {
						ok = false;
						break;
					}

				}
			}

			out.append(ok==true?ans:-1);
			out.append("\n");

		}
		System.out.println(out);
	}

}


import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class A {

	static int mod = (int) 1e9 + 7;

	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int t = 1;// sc.nextInt();

		while (t-- > 0) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			long x = sc.nextInt();
			long k = sc.nextInt();
			long y = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[m];
			HashMap<Integer, Integer> hm = new HashMap<>();
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				hm.put(a[i], i);
			}
			int[] al = new int[m];
			for (int i = 0; i < m; i++) {
				b[i] = sc.nextInt();

				al[i] = hm.get(b[i]);

			}

			int l = 0, lval = 0, rval = 0, r = 0;
			boolean ok = true;
			long ans = 0;
			for (int i = 0; i < m; i++) {
				if (i == 0) {
					l = -1;
					lval = -1;
					r = hm.get(b[i]);
					rval = a[r];
				} else {
					l = hm.get(b[i - 1]);
					r = hm.get(b[i]);
					lval = a[l];
					rval = a[r];
				}

				if (r < l) {
					ok = false;
					break;
				}
				long val = r - l - 1;
				int max = -1;
				for (int j = l + 1; j < r; j++) {
					max = Math.max(a[j], max);
				}
				if (val >= k) {
					if (x <= y * k) {
						ans += y * (val % k) + (val / k) * x;
					} else {
						if (max < lval || max < rval) {
							ans += val * y;
						} else {
							ans += x + (val - k) * y;
						}
					}
				}

				else {

					if (max < lval || max < rval) {
						ans += val * y;
					} else {
						ok = false;
						break;
					}

				}
			}

			if (ok && r < n - 1) {
				l=hm.get(b[m-1]);
				r = n;
				lval = a[l];
				rval = -1;
				int max = -1;
				int val = r - l - 1;
				for (int j = l + 1; j < r; j++) {
					max = Math.max(a[j], max);
				}
				if (val >= k) {
					if (x <= y * k) {
						ans += y * (val % k) + (val / k) * x;
					} else {
						if (max < lval || max < rval) {
							ans += val * y;
						} else {
							ans += x + (val - k) * y;
						}
					}
				}

				else {

					if (max < lval || max < rval) {
						ans += val * y;
					} else {
						ok = false;

					}

				}
			}

			out.append(ok==true?ans:-1);
			out.append("\n");

		}
		System.out.println(out);
	}

}


import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class A {

	static int mod = (int) 1e9 + 7;

	static int ar[];
	static Scanner sc = new Scanner(System.in);
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int t = 1;// sc.nextInt();

		while (t-- > 0) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			long x = sc.nextInt();
			long k = sc.nextInt();
			long y = sc.nextInt();
			int a[] = new int[n];
			int b[] = new int[m];
			HashMap<Integer, Integer> hm = new HashMap<>();
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				hm.put(a[i], i);
			}
			int[] al = new int[m];
			for (int i = 0; i < m; i++) {
				b[i] = sc.nextInt();

				al[i] = hm.get(b[i]);

			}
			long ans = 0;
			boolean ok = true;

			int l = -1;
			int r = 0;
			if (x <= k * y) {

				for (int i = 0; i < m; i++) {

					r = al[i];
					if(r<l) {
						ok=false;
						break;
					}
					int cmin = 0;
					int max = -1;
					long val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (val >= k) {
						ans += (long)((val % k) * y + (val / k) * x);
					} else {
						if (l == -1) {
							if (a[r] > max) {
								ans +=(long)( val * y);
							} else {
								ok = false;
								break;
							}
						}

						else if (max < a[l] || max < a[r]) {
							ans += (long)(val * y);
						} else {
							ok = false;
							break;
						}

					}

					l = al[i];

				}

				if (ok && l < n - 1) {
					r = n;

					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (val >= k) {
						ans += (long)((val % k) * y + (val / k) * x);
					}

					else if (max < a[l]) {
						ans +=(long)( val * y);
					} else {
						ok = false;
						break;
					}

				}

			} else {

				for (int i = 0; i < m; i++) {

					r = al[i];

					if(r<l) {
						ok=false;
						break;
					}
					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (l == -1) {
						if (max < a[r]) {
							ans +=(long)( y * val);
						} else {
							ok = false;

							break;

						}
					}

					else if (max < a[l] || max < a[r]) {
						ans += (long)(y * val);
					} else {

						if (val >= k) {

							ans += (long)(x + (val - k) * y);

						} else {
							ok = false;
							break;
						}
					}

					l = al[i];

				}

				if(ok && l<n-1) {
					r=n;

					int cmin = 0;
					int max = -1;
					int val = (r - l - 1);
					for (int j = l + 1; j < r; j++) {

						max = Math.max(a[j], max);

					}

					if (max < a[l]) {
						ans +=(long)( y * val);
					} else {

						if (val >= k) {

							ans +=(long)( x + (val - k) * y);

						} else {
							ok = false;
							break;
						}
					}
				}

			}

			out.append(ok == true ? ans : -1);
			out.append("\n");
		}
		System.out.println(out);
	}

}


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 fireballAttack = in.nextLong();
            int K = in.nextInt();
            long berserkAttack = in.nextLong();

            int warriors[] = CPUtils.readIntArray(N, in);
            int remWarriors[] = CPUtils.readIntArray(M, in);

            WarriorWrap[] warriorsWarriorWrap = new WarriorWrap[warriors.length];
            int j = 0;
            // keep indices of warriors of warriors, so I can easily use ranges
            List<Integer> warriorToKeepIndices = new ArrayList<>();
            for (int i = 0; i < warriors.length; i++)
            {
                if (j < M && warriors[i] == remWarriors[j])
                {
                    // mark as warrior to keep
                    warriorsWarriorWrap[i] = new WarriorWrap(warriors[i], true);
                    j++;
                    warriorToKeepIndices.add(i);
                } else
                {
                    warriorsWarriorWrap[i] = new WarriorWrap(warriors[i], false);
                }
            }
            // not enough warriors
            if (j != M)
            {
                out.println(-1);
                return;
            }
            try
            {
                out.println(process(warriorToKeepIndices, remWarriors, warriorsWarriorWrap, fireballAttack, K, berserkAttack));
            } catch (Exception e)
            {
                out.println(-1);
            }
        }

        private long process(List<Integer> warriorToKeepIndices, int[] O, WarriorWrap[] warriorsWarriorWrap, long fireballAttack, int K, long berserkAttack) throws Exception
        {
            // adding start end final indeces
            warriorToKeepIndices.add(0, 0);
            warriorToKeepIndices.add(warriorsWarriorWrap.length - 1);
            long cost = 0;
            for (int i = 0; i < warriorToKeepIndices.size() - 1; i++)
            {
                // process single range
                cost += process(warriorToKeepIndices.get(i), warriorToKeepIndices.get(i + 1), warriorsWarriorWrap, fireballAttack, K, berserkAttack);
            }
            return cost;
        }

        private long process(int startIdx, int endIdx, WarriorWrap[] warriorsWarriorWrap, long fireballAttack, int K, long berserkAttack) throws Exception
        {
            if (startIdx >= endIdx) return 0;
            // no warrior to remove
            if (warriorsWarriorWrap[startIdx].keep && warriorsWarriorWrap[endIdx].keep && startIdx + 1 == endIdx)
                return 0;

            int mostPotentWarrior = getMax(startIdx, endIdx, warriorsWarriorWrap);
            // if the most potent warrior isn't the one to keep, probably will need an extra BerserkAttack
            int extraBerserkAttack = 1;

            // if the most potent warrior is the one to keep, then no need of an extra BerserkAttack
            if ((mostPotentWarrior == warriorsWarriorWrap[startIdx].power && warriorsWarriorWrap[startIdx].keep) ||
                        (mostPotentWarrior == warriorsWarriorWrap[endIdx].power && warriorsWarriorWrap[endIdx].keep))
                extraBerserkAttack = 0;

            int warriorsToRemoveLen = (endIdx - startIdx + 1);
            // remove warriors to keep
            warriorsToRemoveLen -= warriorsWarriorWrap[startIdx].keep ? 1 : 0;
            warriorsToRemoveLen -= warriorsWarriorWrap[endIdx].keep ? 1 : 0;

            // if I have to remove the most potent warrior and I can't cast a fireballAttack then it's impossible
            if (extraBerserkAttack == 1 && K > warriorsToRemoveLen) throw new Exception();

            // choose greedily
            if (extraBerserkAttack == 0)
                // first fireballAttack then berserkAttack on remaining
                return Math.min((warriorsToRemoveLen / K) * fireballAttack + (warriorsToRemoveLen % K) * berserkAttack,
                                //only berserkAttack
                                warriorsToRemoveLen * berserkAttack);
            else
            {
                // first fireballAttack then berserkAttack on remaining
                long minCost = (warriorsToRemoveLen / K) * fireballAttack + (warriorsToRemoveLen % K) * berserkAttack;

                // cast a fireballAttack for the most powerful
                warriorsToRemoveLen -= K;
                // then cast a berserkAttack
                long minCost2 = fireballAttack + warriorsToRemoveLen * berserkAttack;
                return Math.min(minCost, minCost2);
            }
        }

        private int getMax(int startIdx, int endIdx, WarriorWrap[] warriorsWarriorWrap)
        {
            int max = Integer.MIN_VALUE;
            for (int i = startIdx; i <= endIdx; i++)
            {
                max = Math.max(max, warriorsWarriorWrap[i].power);
            }
            return max;
        }

    }

    static class WarriorWrap
    {
        int power;
        boolean keep;

        WarriorWrap(int power, boolean keep)
        {
            this.power = power;
            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;
        }

    }
}


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 fireballAttack = in.nextLong();
            int K = in.nextInt();
            long berserkAttack = in.nextLong();

            int warriors[] = CPUtils.readIntArray(N, in);
            int remWarriors[] = CPUtils.readIntArray(M, in);

            WarriorWrap[] warriorsWarriorWrap = new WarriorWrap[warriors.length];
            int j = 0;
            // keep indices of warriors of warriors, so I can easily use ranges
            List<Integer> warriorToKeepIndices = new ArrayList<>();
            for (int i = 0; i < warriors.length; i++)
            {
                if (j < M && warriors[i] == remWarriors[j])
                {
                    // mark as warrior to keep
                    warriorsWarriorWrap[i] = new WarriorWrap(warriors[i], true);
                    j++;
                    warriorToKeepIndices.add(i);
                } else
                {
                    warriorsWarriorWrap[i] = new WarriorWrap(warriors[i], false);
                }
            }
            // not enough warriors
            if (j != M)
            {
                out.println(-1);
                return;
            }
            try
            {
                out.println(process(warriorToKeepIndices, remWarriors, warriorsWarriorWrap, fireballAttack, K, berserkAttack));
            } catch (Exception e)
            {
                out.println(-1);
            }
        }

        private long process(List<Integer> warriorToKeepIndices, int[] O, WarriorWrap[] warriorsWarriorWrap, long fireballAttack, int K, long berserkAttack) throws Exception
        {
            // adding start end final indeces
            warriorToKeepIndices.add(0, 0);
            warriorToKeepIndices.add(warriorsWarriorWrap.length - 1);
            long cost = 0;
            for (int i = 0; i < warriorToKeepIndices.size() - 1; i++)
            {
                // process single range
                cost += process(warriorToKeepIndices.get(i), warriorToKeepIndices.get(i + 1), warriorsWarriorWrap, fireballAttack, K, berserkAttack);
            }
            return cost;
        }

        private long process(int startIdx, int endIdx, WarriorWrap[] warriorsWarriorWrap, long fireballAttack, int K, long berserkAttack) throws Exception
        {
            if (startIdx >= endIdx) return 0;
            // no warrior to remove
            if (warriorsWarriorWrap[startIdx].keep && warriorsWarriorWrap[endIdx].keep && startIdx + 1 == endIdx)
                return 0;

            int mostPotentWarrior = getMax(startIdx, endIdx, warriorsWarriorWrap);
            // if the most potent warrior isn't the one to keep, probably will need an extra BerserkAttack
            int extraBerserkAttack = 1;

            // if the most potent warrior is the one to keep, then no need of an extra BerserkAttack
            if ((mostPotentWarrior == warriorsWarriorWrap[startIdx].power && warriorsWarriorWrap[startIdx].keep) ||
                        (mostPotentWarrior == warriorsWarriorWrap[endIdx].power && warriorsWarriorWrap[endIdx].keep))
                extraBerserkAttack = 0;

            int warriorsToRemoveLen = (endIdx - startIdx + 1);
            // remove warriors to keep
            warriorsToRemoveLen -= warriorsWarriorWrap[startIdx].keep ? 1 : 0;
            warriorsToRemoveLen -= warriorsWarriorWrap[endIdx].keep ? 1 : 0;

            // if I have to remove the most potent warrior and I can't cast a fireballAttack then it's impossible (fail)
            if (extraBerserkAttack == 1 && K > warriorsToRemoveLen) throw new Exception();

            // choose greedily
            if (extraBerserkAttack == 0)
                // first fireballAttack then berserkAttack on remaining
                return Math.min((warriorsToRemoveLen / K) * fireballAttack + (warriorsToRemoveLen % K) * berserkAttack,
                                //only berserkAttack
                                warriorsToRemoveLen * berserkAttack);
            else
            {
                // first fireballAttack then berserkAttack on remaining
                long minCost = (warriorsToRemoveLen / K) * fireballAttack + (warriorsToRemoveLen % K) * berserkAttack;

                // cast a fireballAttack for the most powerful
                warriorsToRemoveLen -= K;
                // then cast a berserkAttack
                long minCost2 = fireballAttack + warriorsToRemoveLen * berserkAttack;
                return Math.min(minCost, minCost2);
            }
        }

        private int getMax(int startIdx, int endIdx, WarriorWrap[] warriorsWarriorWrap)
        {
            int max = Integer.MIN_VALUE;
            for (int i = startIdx; i <= endIdx; i++)
            {
                max = Math.max(max, warriorsWarriorWrap[i].power);
            }
            return max;
        }

    }

    static class WarriorWrap
    {
        int power;
        boolean keep;

        WarriorWrap(int power, boolean keep)
        {
            this.power = power;
            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;
        }

    }
}


import java.io.*;
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) throws Exception {
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		int k = sc.nextInt(), y = sc.nextInt();

		int[] a = new int[n], b = new int[m];

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

		for(int i = 0; i < m; i++) {
			b[i] = sc.nextInt();
		}

		int idx = 0;
		ArrayList<Integer> ans = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			if(idx < m && a[i] == b[idx]) {
				ans.add(i);
				idx++;
			}
		}

		if(ans.size() < m) {
			System.out.println(-1);
			return;
		}

		ans.add(n);
		long cost = 0;
		boolean flag = x < 1L * y * k, valid = true;

		for(int i = 0; i <= m; i++) {
			int prev = i == 0 ? 0 : ans.get(i - 1) + 1;
			int len = ans.get(i) - prev;

			int l = i == 0  ? - 1 : a[ans.get(i - 1)];
			int r = i == m ? -1 : a[ans.get(i)];

			int limit = Math.max(l, r), mx = -1;
			for(int j = prev; j < ans.get(i); j++) {
				mx = Math.max(mx, a[j]);
			}

			if(mx > limit && len < k) {
				valid = false;
				break;
			}

			cost += 1L * (len % k) * y;
			len -= len % k;

			if(flag) {
				cost += 1L * x * (len / k);
			}else {
				if(mx > limit) {
					cost += x;
					len -= k;
				}

				cost += 1L * y * len;
			}

		}

		out.println(valid ? cost : -1);
		out.close();
	}

}

class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public Scanner(String file) throws Exception {
		br = new BufferedReader(new FileReader(file));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

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

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

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


import java.io.*;
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	static final int INF = (int) 1e7;
	static int limit, a[], b[], k;
	static Integer memo[];

	static int dp(int idx, int end) {
		if(idx > end) return INF;
		if(idx == end) return 0;
		if(memo[idx] != null) return memo[idx];

		int cnt = dp(idx + k, end) + 1;

		if(a[idx] < limit) {
			cnt = Math.min(cnt, dp(idx + 1, end));
		}

		return memo[idx] = cnt;
	}

	public static void main(String[] args) throws Exception {
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		k = sc.nextInt();
		int y = sc.nextInt();

		a = new int[n];
		b = new int[m];
		memo = new Integer[n];

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

		for(int i = 0; i < m; i++) {
			b[i] = sc.nextInt();
		}

		int idx = 0;
		ArrayList<Integer> ans = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			if(idx < m && a[i] == b[idx]) {
				ans.add(i);
				idx++;
			}
		}

		if(ans.size() < m) {
			System.out.println(-1);
			return;
		}

		ans.add(n);
		long cost = 0;
		boolean flag = k * x < y, valid = true;

		for(int i = 0; i <= m; i++) {
			int prev = i == 0 ? 0 : ans.get(i - 1) + 1;
			int len = ans.get(i) - prev;
			limit = Math.max(i == m ? -1 : ans.get(i), i == 0  ? - 1 : ans.get(i - 1));

			int cnt = dp(prev, ans.get(i));

			if(cnt >= INF) {
				valid = false;
				break;
			}
			else {
				len -= cnt * k;
				cost += 1L * cnt * x;
			}

			if(flag) {
				cost += 1L * x * (len / k);
				len = (len % k + k) % k;
			}

			cost += 1L * len * y;
		}

		out.println(valid ? cost : -1);
		out.close();
	}

}

class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public Scanner(String file) throws Exception {
		br = new BufferedReader(new FileReader(file));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

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

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

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


import java.io.*;
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	static final int INF = (int) 1e7;
	static int limit, a[], b[], k;
	static Integer memo[];

	static int dp(int idx, int end) {
		if(idx > end) return INF;
		if(idx == end) return 0;
		if(memo[idx] != null) return memo[idx];

		int cnt = dp(idx + k, end) + 1;

		if(a[idx] < limit) {
			cnt = Math.min(cnt, dp(idx + 1, end));
		}

		return memo[idx] = cnt;
	}

	public static void main(String[] args) throws Exception {
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		k = sc.nextInt();
		int y = sc.nextInt();

		a = new int[n];
		b = new int[m];
		memo = new Integer[n];

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

		for(int i = 0; i < m; i++) {
			b[i] = sc.nextInt();
		}

		int idx = 0;
		ArrayList<Integer> ans = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			if(idx < m && a[i] == b[idx]) {
				ans.add(i);
				idx++;
			}
		}

		if(ans.size() < m) {
			System.out.println(-1);
			return;
		}

		ans.add(n);
		long cost = 0;
		boolean flag = x < y, valid = true;

		for(int i = 0; i <= m; i++) {
			int prev = i == 0 ? 0 : ans.get(i - 1) + 1;
			int len = ans.get(i) - prev;
			limit = Math.max(i == m ? -1 : ans.get(i), i == 0  ? - 1 : ans.get(i - 1));

			int cnt = dp(prev, ans.get(i));

			if(cnt >= INF) {
				valid = false;
				break;
			}
			else {
				len -= cnt * k;
				cost += 1L * cnt * x;
			}

			if(flag) {
				cost += 1L * x * (len / k);
				len = (len % k + k) % k;
			}

			cost += 1L * len * y;
		}

		out.println(valid ? cost : -1);
		out.close();
	}

}

class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public Scanner(String file) throws Exception {
		br = new BufferedReader(new FileReader(file));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

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

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

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


import java.io.*;
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	static final int INF = (int) 1e7;
	static int limit, a[], b[], k;
	static Integer memo[];

	static int dp(int idx, int end) {
		if(idx > end) return INF;
		if(idx == end) return 0;
		if(memo[idx] != null) return memo[idx];

		int cnt = dp(idx + k, end) + 1;

		if(a[idx] < limit) {
			cnt = Math.min(cnt, dp(idx + 1, end));
		}

		return memo[idx] = cnt;
	}

	public static void main(String[] args) throws Exception {
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		k = sc.nextInt();
		int y = sc.nextInt();

		a = new int[n];
		b = new int[m];
		memo = new Integer[n];

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

		for(int i = 0; i < m; i++) {
			b[i] = sc.nextInt();
		}

		int idx = 0;
		ArrayList<Integer> ans = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			if(idx < m && a[i] == b[idx]) {
				ans.add(i);
				idx++;
			}
		}

		if(ans.size() < m) {
			System.out.println(-1);
			return;
		}

		ans.add(n);
		long cost = 0;
		boolean flag = x < 1L * y * k, valid = true;

		for(int i = 0; i <= m; i++) {
			int prev = i == 0 ? 0 : ans.get(i - 1) + 1;
			int len = ans.get(i) - prev;
			int l = i == 0  ? - 1 : a[ans.get(i - 1)];
			int r = i == m ? -1 : a[ans.get(i)];

			limit = Math.max(l, r);
			int cnt = dp(prev, ans.get(i));

			if(cnt >= INF) {
				valid = false;
				break;
			}
			else {
				len -= cnt * k;
				cost += 1L * cnt * x;
			}

			if(flag) {
				cost += 1L * x * (len / k);
				len = (len % k + k) % k;
			}

			cost += 1L * len * y;
		}

		out.println(valid ? cost : -1);
		out.close();
	}

}

class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public Scanner(String file) throws Exception {
		br = new BufferedReader(new FileReader(file));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

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

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

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


import java.io.*;
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	static final int INF = (int) 1e7;
	static int limit, a[], b[], k;
	static Integer memo[];

	static int dp(int idx, int end) {
		if(idx > end) return INF;
		if(idx == end) return 0;
		if(memo[idx] != null) return memo[idx];

		int cnt = dp(idx + k, end) + 1;

		if(a[idx] < limit) {
			cnt = Math.min(cnt, dp(idx + 1, end));
		}

		return memo[idx] = cnt;
	}

	public static void main(String[] args) throws Exception {
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		k = sc.nextInt();
		int y = sc.nextInt();

		a = new int[n];
		b = new int[m];
		memo = new Integer[n];

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

		for(int i = 0; i < m; i++) {
			b[i] = sc.nextInt();
		}

		int idx = 0;
		ArrayList<Integer> ans = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			if(idx < m && a[i] == b[idx]) {
				ans.add(i);
				idx++;
			}
		}

		if(ans.size() < m) {
			System.out.println(-1);
			return;
		}

		ans.add(n);
		long cost = 0;
		boolean flag = x < y, valid = true;

		for(int i = 0; i <= m; i++) {
			int prev = i == 0 ? 0 : ans.get(i - 1) + 1;
			int len = ans.get(i) - prev;
			limit = Math.max(ans.get(i), i == 0 || i == m ? - 1 : ans.get(i - 1));

			int cnt = dp(prev, ans.get(i));

			if(cnt >= INF) {
				valid = false;
				break;
			}
			else {
				len -= cnt * k;
				cost += 1L * cnt * x;
			}

			if(flag) {
				cost += 1L * x * (len / k);
				len = (len % k + k) % k;
			}

			cost += 1L * len * y;
		}

		out.println(valid ? cost : -1);
		out.close();
	}

}

class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public Scanner(String file) throws Exception {
		br = new BufferedReader(new FileReader(file));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

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

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

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


import java.io.*;
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	static final int INF = (int) 1e7;
	static int limit, a[], b[], k;
	static Integer memo[];

	static int dp(int idx, int end) {
		if(idx > end) return INF;
		if(idx == end) return 0;
		if(memo[idx] != null) return memo[idx];

		int cnt = dp(idx + k, end) + 1;

		if(a[idx] < limit) {
			cnt = Math.min(cnt, dp(idx + 1, end));
		}

		return memo[idx] = cnt;
	}

	public static void main(String[] args) throws Exception {
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		k = sc.nextInt();
		int y = sc.nextInt();

		a = new int[n];
		b = new int[m];
		memo = new Integer[n];

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

		for(int i = 0; i < m; i++) {
			b[i] = sc.nextInt();
		}

		int idx = 0;
		ArrayList<Integer> ans = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			if(idx < m && a[i] == b[idx]) {
				ans.add(i);
				idx++;
			}
		}

		if(ans.size() < m) {
			System.out.println(-1);
			return;
		}

		ans.add(n);
		long cost = 0;
		boolean flag = k * x < y, valid = true;

		for(int i = 0; i <= m; i++) {
			int prev = i == 0 ? 0 : ans.get(i - 1) + 1;
			int len = ans.get(i) - prev;
			int l = i == 0  ? - 1 : a[ans.get(i - 1)];
			int r = i == m ? -1 : a[ans.get(i)];

			limit = Math.max(l, r);
			int cnt = dp(prev, ans.get(i));

			if(cnt >= INF) {
				valid = false;
				break;
			}
			else {
				len -= cnt * k;
				cost += 1L * cnt * x;
			}

			if(flag) {
				cost += 1L * x * (len / k);
				len = (len % k + k) % k;
			}

			cost += 1L * len * y;
		}

		out.println(valid ? cost : -1);
		out.close();
	}

}

class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public Scanner(String file) throws Exception {
		br = new BufferedReader(new FileReader(file));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

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

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

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


import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
	static final long MOD = 998244353L;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);

		int N = sc.ni();
		int M = sc.ni();
		long X = sc.nl();
		int K = sc.ni();
		long Y = sc.nl();

		long[] dp = new long[N+1];
		for (int i = 1; i <= N; i++) {
			dp[i] = Y+dp[i-1];
			if (i >= K) {
				dp[i] = Math.min(dp[i], X+dp[i-K]);
			}
		}

		int[] A = new int[N];
		for (int i = 0; i < N; i++)
			A[i] = sc.ni()-1;
		int[] B = new int[M];
		for (int i = 0; i < M; i++)
			B[i] = sc.ni()-1;
		long ans = 0L;
		int idx = 0;
		for (int i = 0; i < M; i++) {
			int kill = 0;
			while (idx < N && A[idx] != B[i]) {
				idx++;
				kill++;
			}
			if (idx == N) {
				pw.println(-1);
				pw.close();
				return;
			}
			ans += dp[kill];
			idx++;
		}
		ans += dp[N-idx];
		pw.println(ans);
		pw.close();
	}

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int ni() {
            return Integer.parseInt(next());
        }

        long nl() {
            return Long.parseLong(next());
        }

        double nd() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
	static final long MOD = 998244353L;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);

		int N = sc.ni();
		int M = sc.ni();
		long X = sc.nl();
		int K = sc.ni();
		long Y = sc.nl();

		long[] dp = new long[N+1];
		for (int i = 1; i <= N; i++) {
			dp[i] = Y+dp[i-1];
			if (i >= K) {
				dp[i] = Math.min(dp[i], X+dp[i-K]);
			}
		}

		int[] A = new int[N];
		for (int i = 0; i < N; i++)
			A[i] = sc.ni()-1;
		int[] B = new int[M];
		for (int i = 0; i < M; i++)
			B[i] = sc.ni()-1;
		long ans = 0L;
		int idx = 0;
		for (int i = 0; i < M; i++) {
			int kill = 0;
			int max = 0;
			if (idx == N) {
				pw.println(-1);
				pw.close();
				return;
			}
			int edge = 0;
			if (idx > 0)
				edge = A[idx-1];
			while (idx < N && A[idx] != B[i]) {
				max = Math.max(max, A[idx]);
				idx++;
				kill++;
			}
			if (idx == N) {
				pw.println(-1);
				pw.close();
				return;
			}
			edge = Math.max(edge, A[idx]);
			if (edge >= max) {
				ans += dp[kill];
			} else if (kill >= K) {
				ans += (X+dp[kill-K]);
			} else {
				pw.println(-1);
				pw.close();
				return;
			}

			idx++;
		}
		if (idx < N) {
			int edge = A[idx-1];
			int max = 0;
			for (int i = idx; i < N; i++)
				max = Math.max(A[i],max);
			int kill = N-idx;

			if (edge >= max) {
				ans += dp[kill];
			} else if (kill >= K) {
				ans += (X+dp[kill-K]);
			} else {
				pw.println(-1);
				pw.close();
				return;
			}
		}
		pw.println(ans);
		pw.close();
	}

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int ni() {
            return Integer.parseInt(next());
        }

        long nl() {
            return Long.parseLong(next());
        }

        double nd() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x1380D
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int M = Integer.parseInt(st.nextToken());
         st = new StringTokenizer(infile.readLine());
         int fc = Integer.parseInt(st.nextToken());
         int range = Integer.parseInt(st.nextToken());
         int bc = Integer.parseInt(st.nextToken());
         int[] arr = readArr(N, infile, st);
         int[] brr = readArr(M, infile, st);
         //solve
         if(M > N || wack(arr, brr))
         {
            System.out.println(-1);
            return;
         }
         HashSet<Integer> set = new HashSet<Integer>();
         for(int x: brr)
            set.add(x);
         ArrayList<Integer> ls = new ArrayList<Integer>();
         ls.add(-1);
         for(int i=0; i < N; i++)
            if(set.contains(arr[i]))
               ls.add(i);
         ls.add(N);
         long res = 0L;
         for(int qw=0; qw < ls.size()-1; qw++)
         {
            ArrayList<Integer> temp = new ArrayList<Integer>();
            int max = -1;
            for(int i=ls.get(qw)+1; i < ls.get(qw+1); i++)
            {
               temp.add(arr[i]);
               max = Math.max(max, arr[i]);
            }
            boolean boof = false;
            if(ls.get(qw) >= 0 && arr[ls.get(qw)] < max)
               if(ls.get(qw+1) < N && arr[ls.get(qw+1)] < max)
                  boof = true;
            if(temp.size() < range)
            {
               if(boof)
               {
                  System.out.println(-1);
                  return;
               }
               res += (long)temp.size()*bc;
            }
            else
            {
               if((long)bc*range <= fc)
               {
                  if(!boof)
                     res += (long)temp.size()*bc;
                  else
                     res += (long)(temp.size()-range)*bc+fc;
               }
               else
                  res += (long)(temp.size()%range)*bc+(long)(temp.size()/range)*fc;
            }
         }
         System.out.println(res);
      }
      public static boolean wack(int[] arr, int[] brr)
      {
         HashSet<Integer> set = new HashSet<Integer>();
         for(int x: brr)
            set.add(x);
         ArrayList<Integer> ls = new ArrayList<Integer>();
         for(int x: arr)
            if(set.contains(x))
               ls.add(x);
         if(ls.size() != brr.length)
            return true;
         for(int i=0; i < brr.length; i++)
            if(ls.get(i) != brr[i])
               return true;
         return false;
      }
      public static int[] readArr(int N, BufferedReader infile, StringTokenizer st) throws Exception
      {
         int[] arr = new int[N];
         st = new StringTokenizer(infile.readLine());
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(st.nextToken());
         return arr;
      }
   }


/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x1380D
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int M = Integer.parseInt(st.nextToken());
         st = new StringTokenizer(infile.readLine());
         int fc = Integer.parseInt(st.nextToken());
         int range = Integer.parseInt(st.nextToken());
         int bc = Integer.parseInt(st.nextToken());
         int[] arr = readArr(N, infile, st);
         int[] brr = readArr(M, infile, st);
         //solve
         if(M > N || wack(arr, brr))
         {
            System.out.println(-1);
            return;
         }
         HashSet<Integer> set = new HashSet<Integer>();
         for(int x: brr)
            set.add(x);
         ArrayList<Integer> ls = new ArrayList<Integer>();
         ls.add(-1);
         for(int i=0; i < N; i++)
            if(set.contains(arr[i]))
               ls.add(i);
         ls.add(N);
         long res = 0L;
         for(int qw=0; qw < ls.size()-1; qw++)
         {
            ArrayList<Integer> temp = new ArrayList<Integer>();
            int max = -1;
            for(int i=ls.get(qw)+1; i < ls.get(qw+1); i++)
            {
               temp.add(arr[i]);
               max = Math.max(max, arr[i]);
            }
            boolean boof = true;
            if(ls.get(qw) >= 0 && arr[ls.get(qw)] > max)
               boof = false;
            if(ls.get(qw+1) < N && arr[ls.get(qw+1)] > max)
               boof = false;
            if(temp.size() < range)
            {
               if(boof)
               {
                  System.out.println(-1);
                  return;
               }
               res += (long)temp.size()*bc;
            }
            else
            {
               if((long)bc*range <= fc)
               {
                  if(!boof)
                     res += (long)temp.size()*bc;
                  else
                     res += (long)(temp.size()-range)*bc+fc;
               }
               else
                  res += (long)(temp.size()%range)*bc+(long)(temp.size()/range)*fc;
            }
         }
         System.out.println(res);
      }
      public static boolean wack(int[] arr, int[] brr)
      {
         HashSet<Integer> set = new HashSet<Integer>();
         for(int x: brr)
            set.add(x);
         ArrayList<Integer> ls = new ArrayList<Integer>();
         for(int x: arr)
            if(set.contains(x))
               ls.add(x);
         if(ls.size() != brr.length)
            return true;
         for(int i=0; i < brr.length; i++)
            if(ls.get(i) != brr[i])
               return true;
         return false;
      }
      public static int[] readArr(int N, BufferedReader infile, StringTokenizer st) throws Exception
      {
         int[] arr = new int[N];
         st = new StringTokenizer(infile.readLine());
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(st.nextToken());
         return arr;
      }
   }


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw = new PrintWriter(System.out);
    static int MOD = 1000000007;

    public static void main(String[] args) throws IOException {
        Main m = new Main();
        m.solve();
        m.close();
    }

    void close() throws IOException {
        pw.flush();
        pw.close();
        br.close();
    }

    int ri() throws IOException {
        return Integer.parseInt(br.readLine());
    }

    long rl() throws IOException {
        return Long.parseLong(br.readLine());
    }

    int[] ril(int n) throws IOException {
        int[] nums = new int[n];
        int c = 0;
        for (int i = 0; i < n; i++) {
            int sign = 1;
            c = br.read();
            int x = 0;
            if (c == '-') {
                sign = -1;
                c = br.read();
            }
            while (c >= '0' && c <= '9') {
                x = x * 10 + c - '0';
                c = br.read();
            }
            nums[i] = x * sign;
        }
        while (c != '\n' && c != -1) c = br.read();
        return nums;
    }

    long[] rll(int n) throws IOException {
        long[] nums = new long[n];
        int c = 0;
        for (int i = 0; i < n; i++) {
            int sign = 1;
            c = br.read();
            long x = 0;
            if (c == '-') {
                sign = -1;
                c = br.read();
            }
            while (c >= '0' && c <= '9') {
                x = x * 10 + c - '0';
                c = br.read();
            }
            nums[i] = x * sign;
        }
        while (c != '\n' && c != -1) c = br.read();
        return nums;
    }

    char[] rs() throws IOException {
        return br.readLine().toCharArray();
    }

    void solve() throws IOException {
        int[] nm = ril(2);
        int n = nm[0];
        int m = nm[1];
        int[] xky = ril(3);
        int x = xky[0];
        int k = xky[1];
        int y = xky[2];
        int[] a = ril(n);
        int[] b = ril(m);

        List<Integer> streakDelete = new ArrayList<>();
        List<Integer> maxs = new ArrayList<>();
        int i = 0;
        for (int j = 0; j < m; j++) {
            int count = 0;
            int max = -1;
            while (i < n && a[i] != b[j]) {
                max = Math.max(max, a[i]);
                count++;
                i++;
            }
            if (i == n) {
                streakDelete = null;
                break;
            }
            streakDelete.add(count);
            maxs.add(max);
            count = 0;
            i++;
        }
        if (streakDelete != null) {  // delete to right of last
            int count = 0;
            int max = -1;
            while (i < n) {
                max = Math.max(max, a[i]);
                count++;
                i++;
            }
            streakDelete.add(count);
            maxs.add(max);
        }

        if (streakDelete == null) {
            pw.println("-1");
            return;
        }
        long ans = 0;
        for (i = 0; i < streakDelete.size(); i++) {
            int border = Math.max(i-1>=0?b[i-1]:-1, i<m?b[i]:-1);
            int count = streakDelete.get(i);
            int max = maxs.get(i);
            if (border < max) {
                // must use fireball for last kill
                if (count < k) {
                    pw.println("-1");
                    return;
                }
                long usefire = (long) y * (count % k) + (long) x * (count / k);
                long usebeserk = (long) y * (count - k) + (long) x;
                ans += Math.min(usefire, usebeserk);
            } else {
                long usefire = (long) y * (count % k) + (long) x * (count / k);
                long usebeserk = (long) y * count;
                ans += Math.min(usefire, usebeserk);
            }
        }
        pw.println(ans);
    }
}


import java.io.*;
import java.util.*;
import java.util.concurrent.TimeUnit;

public class d1380 implements Runnable{

    public static void main(String[] args) {
    	try{
            new Thread(null, new d1380(), "process", 1<<26).start();
        }
        catch(Exception e){
            System.out.println(e);
        }
    }
	public void run() {
		FastReader scan = new FastReader();
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		//PrintWriter out = new PrintWriter("file.out");
		Task solver = new Task();
		//int t = scan.nextInt();
		int t = 1;
		for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
		out.close();
	}

	static class Task {
		static final int oo = Integer.MAX_VALUE;
		static final long OO = Long.MAX_VALUE;

		public void solve(int testNumber, FastReader sc, PrintWriter out) {
			int N = sc.nextInt();
			int M = sc.nextInt();

			int X = sc.nextInt();
			int K = sc.nextInt();
			int Y = sc.nextInt();

			int[] a = sc.readArray(N);
			int[] b = sc.readArray(M);

			int[] location = new int[N+1];
			for(int i = 0; i < N; i++) {
				location[a[i]] = i;
			}
			for(int i = 1; i < M; i++) {
				if(location[b[i]] < location[b[i-1]]) {
					out.println(-1);
					return;
				}
			}

			List<Integer> LR = new ArrayList<>();
			LR.add(-1);
			for(int i = 0; i < M; i++) {
				LR.add(location[b[i]]);
			}
			LR.add(N);
			//dbg(LR);

			long total = 0;
			for(int i = 1; i < LR.size(); i++) {
				int R = LR.get(i);
				int L = LR.get(i-1);
				int MAX;
				if(L == -1)
					MAX = a[R];
				else if (R == N)
					MAX = a[L];
				else
					MAX = Math.max(a[R], a[L]);

				int countHigher = 0;
				for(int j = L+1; j < R; j++) {
					if(a[j] > MAX) {
						countHigher++;
					}
				}

				if(R - L - 1 < K) {
					// only berserk is possible
					if(countHigher > 0) {
						out.println(-1);
						return;
					}
					total += (R - L - 1) * Y;
				} else {
					if(Y * K <= X) {
						// Berserk is better than, or just as good as fireball, so we can greedy it
						if(countHigher == 0) {
							// Berserk all of them
							total += (R - L - 1) * Y;
						} else {
							// Berserk all of them except for the last K, since it will have to be fireballed
							total += (R - L - 1 - K) * Y + X;
						}
					} else {
						// Fireball is better than beserk, so we should fireball as much as possible
						int countLower = (R - L - 1 - countHigher); // number that are able to be "finished off"
						if((R - L - 1) % K > countLower) {
							// there will be a higher one left, and thus impossible
							out.println(-1);
							return;
						} else {
							total += X * ((R - L - 1) / K);
							total += Y * ((R - L - 1) % K);
						}
					}
				}
			}

			out.println(total);
		}
	}

	static long modDivide(long a, long b, long MOD) {
		a %= MOD;
		return (binpow(b, MOD-2, MOD) * a) % MOD;
	}
	static long binpow(long a, long b, long m) {
		a %= m;
		long res = 1;
		while (b > 0) {
			if ((b & 1) == 1)
				res = res * a % m;
			a = a * a % m;
			b >>= 1;
		}
		return res;
	}
	static int[] reverse(int a[])
    {
        int[] b = new int[a.length];
        for (int i = 0, j = a.length; i < a.length; i++, j--) {
            b[j - 1] = a[i];
        }

        return b;
    }
	static long[] reverse(long a[])
    {
        long[] b = new long[a.length];
        for (int i = 0, j = a.length; i < a.length; i++, j--) {
            b[j - 1] = a[i];
        }

        return b;
    }
	static void sort(int[] x){
		shuffle(x);
		Arrays.sort(x);
	}
	static void sort(long[] x){
		shuffle(x);
		Arrays.sort(x);
	}
	static class tup implements Comparable<tup>, Comparator<tup>{
		int a, b;
		tup(int a,int b){
			this.a=a;
			this.b=b;
		}
		public tup() {
		}
		@Override
		public int compareTo(tup o){
			return Integer.compare(b,o.b);
		}
		@Override
		public int compare(tup o1, tup o2) {
			return Integer.compare(o1.b, o2.b);
		}

		@Override
	    public int hashCode() {
			return Objects.hash(a, b);
	    }

	    @Override
	    public boolean equals(Object obj) {
	    	if (this == obj)
                return true;
	    	if (obj == null)
                return false;
	    	if (getClass() != obj.getClass())
                return false;
	    	tup other = (tup) obj;
	    	return a==other.a && b==other.b;
	    }

	    @Override
	    public String toString() {
	    	return a + " " + b;
	    }
	}

	static void shuffle(int[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			int temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static void shuffle(long[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			long temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastReader(String s) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(new File(s)));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int[] readArray(int size) {
			int[] a = new int[size];
			for(int i = 0; i < size; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		long[] readLongArray(int size) {
			long[] a = new long[size];
			for(int i = 0; i < size; i++) {
				a[i] = nextLong();
			}
			return a;
		}
	}

	static void dbg(int[] arr) {
		System.out.println(Arrays.toString(arr));
	}
	static void dbg(long[] arr) {
		System.out.println(Arrays.toString(arr));
	}
	static void dbg(boolean[] arr) {
		System.out.println(Arrays.toString(arr));
	}

	static void dbg(Object... args) {
        for (Object arg : args)
            System.out.print(arg + " ");
        System.out.println();
    }
}