#include <bits/stdc++.h>
using namespace std;
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream second(s);
  string x;
  while (getline(second, x, c)) v.emplace_back(x);
  return move(v);
}
template <typename T, typename... Args>
inline string arrStr(T arr, int n) {
  stringstream s;
  s << "[";
  for (int i = 0; i < n - 1; i++) s << arr[i] << ",";
  s << arr[n - 1] << "]";
  return s.str();
}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template <typename T>
inline void __evars_out_var(vector<T> val) {
  cerr << arrStr(val, val.size());
}
template <typename T>
inline void __evars_out_var(T* val) {
  cerr << arrStr(val, 10);
}
template <typename T>
inline void __evars_out_var(T val) {
  cerr << val;
}
inline void __evars(vector<string>::iterator it) { cerr << '\n'; }
template <typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
  __evars_out_var(a);
  cerr << "; ";
  __evars(++it, args...);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int dx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[8] = {0, 0, -1, 1, 2, -2, 2, -2};
int myrandom(int i) { return std::rand() % i; }
const int MAX = 200010;
const unsigned long long inf = 1000000007;
int ans = 0, maxi = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long x, k, y;
  cin >> x >> k >> y;
  vector<long long> v(n), t(m);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    cin >> v[i];
  }
  for (__typeof(m) j = (0) - ((0) > (m)); j != (m) - ((0) > (m));
       j += 1 - 2 * ((0) > (m))) {
    cin >> t[j];
  }
  vector<long long> vis(n, 0);
  int i = 0, j = 0, cnt = 0;
  while (i < n && j < m) {
    if (v[i] == t[j]) {
      vis[i] = 1;
      i++;
      j++;
      cnt++;
    } else {
      i++;
    }
  }
  if (cnt != m) {
    cout << -1 << '\n';
    return 0;
  }
  i = 0;
  long long ans = 0;
  while (i < n) {
    while (i < n && vis[i] == 1) {
      i++;
    }
    if (i == n) break;
    int l = i;
    vector<long long> temp;
    while (i < n && vis[i] == 0) {
      temp.push_back(v[i]);
      i++;
    }
    sort((temp).begin(), (temp).end());
    if (y * k > x) {
      if ((int)temp.size() >= k) {
        ans += ((long long)temp.size() % k) * y;
        ans += ((long long)temp.size() / k) * x;
      } else {
        long long left = l - 1 >= 0 ? v[l - 1] : 0;
        long long right = i < n ? v[i] : 0;
        if (temp.back() < max(left, right)) {
          ans += (long long)temp.size() * y;
        } else {
          cout << -1 << '\n';
          return 0;
        }
      }
    } else {
      long long left = l - 1 >= 0 ? v[l - 1] : 0;
      long long right = i < n ? v[i] : 0;
      if ((long long)temp.size() >= k) {
        if (temp.back() < max(left, right)) {
          ans += (long long)temp.size() * y;
        } else {
          ans += ((long long)temp.size() - k) * y + x;
        }
      } else {
        if (temp.back() < max(left, right)) {
          ans += (long long)temp.size() * y;
        } else {
          cout << -1 << '\n';
          return 0;
        }
      }
    }
  }
  cout << ans << '\n';
}

### Prompt

In Cpp, your task is to solve 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;
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream second(s);
  string x;
  while (getline(second, x, c)) v.emplace_back(x);
  return move(v);
}
template <typename T, typename... Args>
inline string arrStr(T arr, int n) {
  stringstream s;
  s << "[";
  for (int i = 0; i < n - 1; i++) s << arr[i] << ",";
  s << arr[n - 1] << "]";
  return s.str();
}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template <typename T>
inline void __evars_out_var(vector<T> val) {
  cerr << arrStr(val, val.size());
}
template <typename T>
inline void __evars_out_var(T* val) {
  cerr << arrStr(val, 10);
}
template <typename T>
inline void __evars_out_var(T val) {
  cerr << val;
}
inline void __evars(vector<string>::iterator it) { cerr << '\n'; }
template <typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
  __evars_out_var(a);
  cerr << "; ";
  __evars(++it, args...);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int dx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[8] = {0, 0, -1, 1, 2, -2, 2, -2};
int myrandom(int i) { return std::rand() % i; }
const int MAX = 200010;
const unsigned long long inf = 1000000007;
int ans = 0, maxi = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long x, k, y;
  cin >> x >> k >> y;
  vector<long long> v(n), t(m);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    cin >> v[i];
  }
  for (__typeof(m) j = (0) - ((0) > (m)); j != (m) - ((0) > (m));
       j += 1 - 2 * ((0) > (m))) {
    cin >> t[j];
  }
  vector<long long> vis(n, 0);
  int i = 0, j = 0, cnt = 0;
  while (i < n && j < m) {
    if (v[i] == t[j]) {
      vis[i] = 1;
      i++;
      j++;
      cnt++;
    } else {
      i++;
    }
  }
  if (cnt != m) {
    cout << -1 << '\n';
    return 0;
  }
  i = 0;
  long long ans = 0;
  while (i < n) {
    while (i < n && vis[i] == 1) {
      i++;
    }
    if (i == n) break;
    int l = i;
    vector<long long> temp;
    while (i < n && vis[i] == 0) {
      temp.push_back(v[i]);
      i++;
    }
    sort((temp).begin(), (temp).end());
    if (y * k > x) {
      if ((int)temp.size() >= k) {
        ans += ((long long)temp.size() % k) * y;
        ans += ((long long)temp.size() / k) * x;
      } else {
        long long left = l - 1 >= 0 ? v[l - 1] : 0;
        long long right = i < n ? v[i] : 0;
        if (temp.back() < max(left, right)) {
          ans += (long long)temp.size() * y;
        } else {
          cout << -1 << '\n';
          return 0;
        }
      }
    } else {
      long long left = l - 1 >= 0 ? v[l - 1] : 0;
      long long right = i < n ? v[i] : 0;
      if ((long long)temp.size() >= k) {
        if (temp.back() < max(left, right)) {
          ans += (long long)temp.size() * y;
        } else {
          ans += ((long long)temp.size() - k) * y + x;
        }
      } else {
        if (temp.back() < max(left, right)) {
          ans += (long long)temp.size() * y;
        } else {
          cout << -1 << '\n';
          return 0;
        }
      }
    }
  }
  cout << ans << '\n';
}

```