#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
void itval(istream_iterator<string> it) {}
template <typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  itval(++it, args...);
}
const long long int MOD = 1e9 + 7;
template <typename T>
inline void print(T x) {
  cout << x << "\n";
}
template <typename T>
inline void printvec(T x) {
  for (auto a : x) cout << a << ' ';
  cout << '\n';
}
struct custom {
  bool operator()(
      const pair<long long int, pair<long long int, long long int> > &p1,
      const pair<long long int, pair<long long int, long long int> > &p2)
      const {
    return p1.first < p2.first;
  }
};
long long int get_pow(long long int a, long long int b, long long int M = MOD) {
  long long int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % M;
    a = (a * a) % M;
    b >>= 1;
  }
  return res;
}
const long long int N = 2e5 + 5, inf = 2e18;
int sparse_mat_max[N][22];
int log_value[N];
void compute_sparse() {
  log_value[1] = 0;
  for (int i = 2; i < N; i++) {
    log_value[i] = log_value[i / 2] + 1;
  }
  for (int j = 1; j < 22; j++) {
    for (long long int i = 0; i + (1ll << j) < N; i++) {
      sparse_mat_max[i][j] = max(sparse_mat_max[i][j - 1],
                                 sparse_mat_max[i + (1ll << (j - 1))][j - 1]);
    }
  }
}
inline int query(int L, int R) {
  int j = log_value[R - L + 1];
  return max(sparse_mat_max[L][j], sparse_mat_max[R - (1 << j) + 1][j]);
}
void solve() {
  int n, m;
  cin >> n >> m;
  if (m > n) {
    cout << -1;
    exit(0);
  }
  long long int x, y, k;
  cin >> x >> k >> y;
  vector<long long> a(n), b(m);
  for (long long int i = (long long int)0; i < (long long int)(n); i++) {
    cin >> a[i];
    sparse_mat_max[i][0] = a[i];
  }
  for (long long int i = (long long int)0; i < (long long int)(m); i++) {
    cin >> b[i];
  }
  compute_sparse();
  vector<long long> keep = {-1};
  int c = 0;
  for (long long int i = (long long int)0; i < (long long int)(n); i++) {
    if (c < m && a[i] == b[c]) {
      keep.push_back(i);
      c++;
    }
  }
  keep.push_back(n);
  if (c != m) {
    cout << -1;
    return;
  }
  long long int ans = 0, len = 0;
  for (long long int i = (long long int)1; i < (long long int)(keep.size());
       i++) {
    len = keep[i] - keep[i - 1] - 1;
    if (len > 0) {
      if (len < k) {
        int t = query(keep[i - 1] + 1, keep[i] - 1);
        int l = -1, r = -1;
        if (keep[i - 1] != -1) l = a[keep[i - 1]];
        if (keep[i] != n) r = a[keep[i]];
        if (l > t || r > t) {
          ans += (y * len);
        } else {
          cout << -1;
          return;
        }
      } else {
        if (k * y < x) {
          int t = query(keep[i - 1] + 1, keep[i] - 1);
          int l = -1, r = -1;
          if (keep[i - 1] != -1) l = a[keep[i - 1]];
          if (keep[i] != n) r = a[keep[i]];
          if (l > t || r > t) {
            ans += (y * len);
            continue;
          }
          long long int lef = len - k;
          ans += (x + lef * y);
          continue;
        }
        long long int md = len % k;
        ans += (x * (len / k) + y * md);
      }
    }
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int test = 1;
  clock_t z = clock();
  for (long long int tes = (long long int)0; tes < (long long int)(test);
       tes++) {
    solve();
  }
  fprintf(stderr, "Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC),
      fflush(stderr);
  return 0;
}

### Prompt

Please create a solution in cpp 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>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
void itval(istream_iterator<string> it) {}
template <typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  itval(++it, args...);
}
const long long int MOD = 1e9 + 7;
template <typename T>
inline void print(T x) {
  cout << x << "\n";
}
template <typename T>
inline void printvec(T x) {
  for (auto a : x) cout << a << ' ';
  cout << '\n';
}
struct custom {
  bool operator()(
      const pair<long long int, pair<long long int, long long int> > &p1,
      const pair<long long int, pair<long long int, long long int> > &p2)
      const {
    return p1.first < p2.first;
  }
};
long long int get_pow(long long int a, long long int b, long long int M = MOD) {
  long long int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % M;
    a = (a * a) % M;
    b >>= 1;
  }
  return res;
}
const long long int N = 2e5 + 5, inf = 2e18;
int sparse_mat_max[N][22];
int log_value[N];
void compute_sparse() {
  log_value[1] = 0;
  for (int i = 2; i < N; i++) {
    log_value[i] = log_value[i / 2] + 1;
  }
  for (int j = 1; j < 22; j++) {
    for (long long int i = 0; i + (1ll << j) < N; i++) {
      sparse_mat_max[i][j] = max(sparse_mat_max[i][j - 1],
                                 sparse_mat_max[i + (1ll << (j - 1))][j - 1]);
    }
  }
}
inline int query(int L, int R) {
  int j = log_value[R - L + 1];
  return max(sparse_mat_max[L][j], sparse_mat_max[R - (1 << j) + 1][j]);
}
void solve() {
  int n, m;
  cin >> n >> m;
  if (m > n) {
    cout << -1;
    exit(0);
  }
  long long int x, y, k;
  cin >> x >> k >> y;
  vector<long long> a(n), b(m);
  for (long long int i = (long long int)0; i < (long long int)(n); i++) {
    cin >> a[i];
    sparse_mat_max[i][0] = a[i];
  }
  for (long long int i = (long long int)0; i < (long long int)(m); i++) {
    cin >> b[i];
  }
  compute_sparse();
  vector<long long> keep = {-1};
  int c = 0;
  for (long long int i = (long long int)0; i < (long long int)(n); i++) {
    if (c < m && a[i] == b[c]) {
      keep.push_back(i);
      c++;
    }
  }
  keep.push_back(n);
  if (c != m) {
    cout << -1;
    return;
  }
  long long int ans = 0, len = 0;
  for (long long int i = (long long int)1; i < (long long int)(keep.size());
       i++) {
    len = keep[i] - keep[i - 1] - 1;
    if (len > 0) {
      if (len < k) {
        int t = query(keep[i - 1] + 1, keep[i] - 1);
        int l = -1, r = -1;
        if (keep[i - 1] != -1) l = a[keep[i - 1]];
        if (keep[i] != n) r = a[keep[i]];
        if (l > t || r > t) {
          ans += (y * len);
        } else {
          cout << -1;
          return;
        }
      } else {
        if (k * y < x) {
          int t = query(keep[i - 1] + 1, keep[i] - 1);
          int l = -1, r = -1;
          if (keep[i - 1] != -1) l = a[keep[i - 1]];
          if (keep[i] != n) r = a[keep[i]];
          if (l > t || r > t) {
            ans += (y * len);
            continue;
          }
          long long int lef = len - k;
          ans += (x + lef * y);
          continue;
        }
        long long int md = len % k;
        ans += (x * (len / k) + y * md);
      }
    }
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int test = 1;
  clock_t z = clock();
  for (long long int tes = (long long int)0; tes < (long long int)(test);
       tes++) {
    solve();
  }
  fprintf(stderr, "Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC),
      fflush(stderr);
  return 0;
}

```