#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
struct dat {
  long long int minm = 2e18;
  long long int maxm = -minm;
  dat() {}
  dat(long long int val) { minm = maxm = val; }
};
struct SegmentTree {
  vector<long long int> arr;
  long long int n;
  dat combine(const dat &l, const dat &r) {
    dat ret;
    ret.minm = min(l.minm, r.minm);
    ret.maxm = max(l.maxm, r.maxm);
    return ret;
  }
  vector<dat> tree;
  SegmentTree(vector<long long int> &a) {
    arr = a;
    n = a.size();
    tree.resize(4 * n);
    build(1, 0, n - 1);
  }
  SegmentTree(long long int cap) {
    n = cap;
    arr.resize(n, 0);
    tree.resize(4 * n);
  }
  void build(long long int v, long long int tl, long long int tr) {
    if (tl == tr) {
      tree[v] = dat(arr[tl]);
    } else {
      int tm = (tl + tr) / 2;
      build(v * 2, tl, tm);
      build(v * 2 + 1, tm + 1, tr);
      tree[v] = combine(tree[v * 2], tree[v * 2 + 1]);
    }
  }
  void update(long long int v, long long int tl, long long int tr,
              long long int pos, long long int new_val) {
    if (tl == tr) {
      arr[pos] = new_val;
      tree[v] = dat(arr[pos]);
    } else {
      int tm = (tl + tr) / 2;
      if (pos <= tm)
        update(v * 2, tl, tm, pos, new_val);
      else
        update(v * 2 + 1, tm + 1, tr, pos, new_val);
      tree[v] = combine(tree[v * 2], tree[v * 2 + 1]);
    }
  }
  dat query(long long int v, long long int tl, long long int tr,
            long long int l, long long int r) {
    if (l > r) return dat();
    if (l == tl && r == tr) {
      return tree[v];
    }
    long long int tm = (tl + tr) / 2;
    return combine(query(v * 2, tl, tm, l, min(r, tm)),
                   query(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r));
  }
  void update(long long int pos, long long int val) {
    update(1, 0, n - 1, pos, val);
  }
  dat query(long long int l, long long int r) {
    return query(1, 0, n - 1, l, r);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int T = clock();
  long long int n, m;
  cin >> n >> m;
  long long int x, k, y;
  cin >> x >> k >> y;
  vector<long long int> pos, a(n), b(m);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int i = 0; i < m; i++) cin >> b[i];
  long long int j = 0;
  for (long long int i = 0; i < n; i++) {
    if (j == m) break;
    if (a[i] == b[j]) {
      pos.push_back(i);
      j++;
    }
  }
  if (j != m) {
    cout << -1;
    return 0;
  }
  long long int ans = 0;
  bool ok = true;
  if (pos[0] > 0) {
    vector<long long int> c;
    for (long long int i = 0; i < pos[0]; i++) c.push_back(a[i]);
    long long int cur = a[pos[0]];
    sort(c.begin(), c.end(), greater<long long int>());
    long long int r = c.size();
    long long int rep = r / k;
    if (r < k && c[0] > cur) {
      cout << -1;
      return 0;
    }
    long long int val = 9223372036854775807;
    if (cur > c[0]) val = min(val, y * r);
    for (long long int i = k; i <= r; i += k)
      val = min(val, x * i / k + y * (r - i));
    ans += val;
  }
  for (long long int i = 1; i < m; i++) {
    if (pos[i] - pos[i - 1] == 1) continue;
    vector<long long int> c;
    for (long long int j = pos[i - 1] + 1; j < pos[i]; j++) c.push_back(a[j]);
    long long int cur = max(a[pos[i]], a[pos[i - 1]]);
    sort(c.begin(), c.end(), greater<long long int>());
    long long int r = c.size();
    long long int rep = r / k;
    if (r < k && c[0] > cur) {
      cout << -1;
      return 0;
    }
    long long int val = 9223372036854775807;
    if (cur > c[0]) val = min(val, y * r);
    for (long long int j = k; j <= r; j += k)
      val = min(val, x * j / k + y * (r - j));
    ans += val;
  }
  if (pos[m - 1] < n - 1) {
    vector<long long int> c;
    for (long long int i = pos[m - 1] + 1; i < n; i++) c.push_back(a[i]);
    long long int cur = a[pos[m - 1]];
    sort(c.begin(), c.end(), greater<long long int>());
    long long int r = c.size();
    long long int rep = r / k;
    if (r < k && c[0] > cur) {
      cout << -1;
      return 0;
    }
    long long int val = 9223372036854775807;
    if (cur > c[0]) val = min(val, y * r);
    for (long long int i = k; i <= r; i += k)
      val = min(val, x * i / k + y * (r - i));
    ans += val;
  }
  cout << ans;
  cerr << "\n\nTIME: " << (double)(clock() - T) / CLOCKS_PER_SEC << " sec\n";
  T = clock();
  return 0;
}

### Prompt

Your challenge is to write a Cpp solution to the following problem:

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

You have two types of spells which you may cast: 

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



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

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

Input

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

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

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

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

Output

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

Examples

Input


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


Output


8


Input


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


Output


-1


Input


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


Output


0

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
struct dat {
  long long int minm = 2e18;
  long long int maxm = -minm;
  dat() {}
  dat(long long int val) { minm = maxm = val; }
};
struct SegmentTree {
  vector<long long int> arr;
  long long int n;
  dat combine(const dat &l, const dat &r) {
    dat ret;
    ret.minm = min(l.minm, r.minm);
    ret.maxm = max(l.maxm, r.maxm);
    return ret;
  }
  vector<dat> tree;
  SegmentTree(vector<long long int> &a) {
    arr = a;
    n = a.size();
    tree.resize(4 * n);
    build(1, 0, n - 1);
  }
  SegmentTree(long long int cap) {
    n = cap;
    arr.resize(n, 0);
    tree.resize(4 * n);
  }
  void build(long long int v, long long int tl, long long int tr) {
    if (tl == tr) {
      tree[v] = dat(arr[tl]);
    } else {
      int tm = (tl + tr) / 2;
      build(v * 2, tl, tm);
      build(v * 2 + 1, tm + 1, tr);
      tree[v] = combine(tree[v * 2], tree[v * 2 + 1]);
    }
  }
  void update(long long int v, long long int tl, long long int tr,
              long long int pos, long long int new_val) {
    if (tl == tr) {
      arr[pos] = new_val;
      tree[v] = dat(arr[pos]);
    } else {
      int tm = (tl + tr) / 2;
      if (pos <= tm)
        update(v * 2, tl, tm, pos, new_val);
      else
        update(v * 2 + 1, tm + 1, tr, pos, new_val);
      tree[v] = combine(tree[v * 2], tree[v * 2 + 1]);
    }
  }
  dat query(long long int v, long long int tl, long long int tr,
            long long int l, long long int r) {
    if (l > r) return dat();
    if (l == tl && r == tr) {
      return tree[v];
    }
    long long int tm = (tl + tr) / 2;
    return combine(query(v * 2, tl, tm, l, min(r, tm)),
                   query(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r));
  }
  void update(long long int pos, long long int val) {
    update(1, 0, n - 1, pos, val);
  }
  dat query(long long int l, long long int r) {
    return query(1, 0, n - 1, l, r);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int T = clock();
  long long int n, m;
  cin >> n >> m;
  long long int x, k, y;
  cin >> x >> k >> y;
  vector<long long int> pos, a(n), b(m);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int i = 0; i < m; i++) cin >> b[i];
  long long int j = 0;
  for (long long int i = 0; i < n; i++) {
    if (j == m) break;
    if (a[i] == b[j]) {
      pos.push_back(i);
      j++;
    }
  }
  if (j != m) {
    cout << -1;
    return 0;
  }
  long long int ans = 0;
  bool ok = true;
  if (pos[0] > 0) {
    vector<long long int> c;
    for (long long int i = 0; i < pos[0]; i++) c.push_back(a[i]);
    long long int cur = a[pos[0]];
    sort(c.begin(), c.end(), greater<long long int>());
    long long int r = c.size();
    long long int rep = r / k;
    if (r < k && c[0] > cur) {
      cout << -1;
      return 0;
    }
    long long int val = 9223372036854775807;
    if (cur > c[0]) val = min(val, y * r);
    for (long long int i = k; i <= r; i += k)
      val = min(val, x * i / k + y * (r - i));
    ans += val;
  }
  for (long long int i = 1; i < m; i++) {
    if (pos[i] - pos[i - 1] == 1) continue;
    vector<long long int> c;
    for (long long int j = pos[i - 1] + 1; j < pos[i]; j++) c.push_back(a[j]);
    long long int cur = max(a[pos[i]], a[pos[i - 1]]);
    sort(c.begin(), c.end(), greater<long long int>());
    long long int r = c.size();
    long long int rep = r / k;
    if (r < k && c[0] > cur) {
      cout << -1;
      return 0;
    }
    long long int val = 9223372036854775807;
    if (cur > c[0]) val = min(val, y * r);
    for (long long int j = k; j <= r; j += k)
      val = min(val, x * j / k + y * (r - j));
    ans += val;
  }
  if (pos[m - 1] < n - 1) {
    vector<long long int> c;
    for (long long int i = pos[m - 1] + 1; i < n; i++) c.push_back(a[i]);
    long long int cur = a[pos[m - 1]];
    sort(c.begin(), c.end(), greater<long long int>());
    long long int r = c.size();
    long long int rep = r / k;
    if (r < k && c[0] > cur) {
      cout << -1;
      return 0;
    }
    long long int val = 9223372036854775807;
    if (cur > c[0]) val = min(val, y * r);
    for (long long int i = k; i <= r; i += k)
      val = min(val, x * i / k + y * (r - i));
    ans += val;
  }
  cout << ans;
  cerr << "\n\nTIME: " << (double)(clock() - T) / CLOCKS_PER_SEC << " sec\n";
  T = clock();
  return 0;
}

```