#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
void _print(long long t) { cerr << t; }
void _print(int t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(long double t) { cerr << t; }
void _print(double t) { cerr << t; }
void _print(unsigned long long t) { cerr << t; }
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T, class V>
void _print(pair<T, V> p) {
  cerr << "{";
  _print(p.first);
  cerr << ",";
  _print(p.second);
  cerr << "}";
}
template <class T>
void _print(vector<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(set<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(multiset<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v) {
  cerr << "[ ";
  for (auto i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
T gcd(T a, T b) {
  while (a != 0) {
    T temp = a;
    a = b % a;
    b = temp;
  }
  return b;
}
template <class T>
T egcd(T a, T b, T &x, T &y) {
  T gcd, xt, yt;
  if (a == 0) {
    gcd = b;
    x = 0, y = 1;
  } else {
    gcd = egcd(b % a, a, xt, yt);
    x = yt - (b / a) * xt;
    y = xt;
  }
  return gcd;
}
template <class T>
T expo(T base, T exp, T mod) {
  T res = 1;
  base = base % mod;
  while (exp > 0) {
    if (exp & 1) res = (res * base) % mod;
    exp = exp >> 1;
    base = (base * base) % mod;
  }
  return res;
}
template <class T>
T modinv(T a, T mod) {
  T x, y;
  egcd<T>(a, mod, x, y);
  while (x < 0) x += mod;
  while (x >= mod) x -= mod;
  return x;
}
template <class T>
T modinvfermat(T a, T mod) {
  return expo<T>(a, mod - 2, mod);
}
template <class T>
bool rev(T a, T b) {
  return a > b;
}
template <class T>
long long maxpower(T a, T b) {
  long long ans = 0;
  while (a > 0 && a % b == 0) {
    ans++;
    a /= b;
  }
  return ans;
}
template <class T>
T mceil(T a, T b) {
  if (a % b == 0)
    return a / b;
  else
    return a / b + 1;
}
template <class T>
T lcm(T a, T b) {
  return (a * b) / gcd<T>(a, b);
}
const long long infl = 1e18 + 5;
const int inf = 1e9 + 5;
void test_case() {
  int n, m;
  cin >> n >> m;
  long long x, k, y;
  cin >> x >> k >> y;
  vector<long long> a(n), b(m);
  for (int i = 0; i < (int)n; i++) cin >> a[i];
  for (int i = 0; i < (int)m; i++) cin >> b[i];
  if (m > n) {
    cout << -1;
    return;
  }
  int cur = 0;
  int found = true;
  vector<vector<pair<long long, long long>>> fin;
  for (int i = (int)(0); i < (int)(m); i++) {
    vector<pair<long long, long long>> temp;
    while (cur < n and a[cur] != b[i]) {
      temp.push_back(make_pair(a[cur], cur));
      cur++;
    }
    if (cur >= n) {
      found = false;
      break;
    }
    cur++;
    if (((int)(temp).size()) != 0) fin.push_back(temp);
  }
  if (!found) {
    cout << -1;
    return;
  }
  vector<pair<long long, long long>> temp;
  for (int i = (int)(cur); i < (int)(n); i++) {
    temp.push_back(make_pair(a[i], i));
  }
  if (((int)(temp).size()) != 0) fin.push_back(temp);
  long long ans = 0;
  ;
  if (k * y <= x) {
    for (auto &segment : fin) {
      long long l = segment[0].second - 1;
      long long r = segment.back().second + 1;
      if (l == -1)
        l = -infl;
      else
        l = a[l];
      if (r == n)
        r = -infl;
      else
        r = a[r];
      long long ma = max_element(segment.begin(), segment.end())->first;
      long long si = ((int)(segment).size());
      if (ma < l or ma < r) {
        ans += si * y;
      } else {
        if (si < k) {
          cout << -1;
          return;
        } else {
          ans += (si - k) * y + x;
        }
      }
    }
  } else {
    for (auto &segment : fin) {
      long long l = segment[0].second - 1;
      long long r = segment.back().second + 1;
      if (l == -1)
        l = -infl;
      else
        l = a[l];
      if (r == n)
        r = -infl;
      else
        r = a[r];
      long long ma = max_element(segment.begin(), segment.end())->first;
      long long si = ((int)(segment).size());
      if (si < k) {
        if (ma > r and ma > l) {
          cout << -1;
          return;
        } else {
          ans += si * y;
        }
      } else {
        ans += (si % k) * y + (si / k) * x;
      }
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int _;
  _ = 1;
  auto start = high_resolution_clock::now();
  cout << setprecision(20);
  while (_--) {
    test_case();
  }
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<milliseconds>(stop - start);
  return 0;
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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;
using namespace std::chrono;
void _print(long long t) { cerr << t; }
void _print(int t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(long double t) { cerr << t; }
void _print(double t) { cerr << t; }
void _print(unsigned long long t) { cerr << t; }
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T, class V>
void _print(pair<T, V> p) {
  cerr << "{";
  _print(p.first);
  cerr << ",";
  _print(p.second);
  cerr << "}";
}
template <class T>
void _print(vector<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(set<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(multiset<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v) {
  cerr << "[ ";
  for (auto i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
T gcd(T a, T b) {
  while (a != 0) {
    T temp = a;
    a = b % a;
    b = temp;
  }
  return b;
}
template <class T>
T egcd(T a, T b, T &x, T &y) {
  T gcd, xt, yt;
  if (a == 0) {
    gcd = b;
    x = 0, y = 1;
  } else {
    gcd = egcd(b % a, a, xt, yt);
    x = yt - (b / a) * xt;
    y = xt;
  }
  return gcd;
}
template <class T>
T expo(T base, T exp, T mod) {
  T res = 1;
  base = base % mod;
  while (exp > 0) {
    if (exp & 1) res = (res * base) % mod;
    exp = exp >> 1;
    base = (base * base) % mod;
  }
  return res;
}
template <class T>
T modinv(T a, T mod) {
  T x, y;
  egcd<T>(a, mod, x, y);
  while (x < 0) x += mod;
  while (x >= mod) x -= mod;
  return x;
}
template <class T>
T modinvfermat(T a, T mod) {
  return expo<T>(a, mod - 2, mod);
}
template <class T>
bool rev(T a, T b) {
  return a > b;
}
template <class T>
long long maxpower(T a, T b) {
  long long ans = 0;
  while (a > 0 && a % b == 0) {
    ans++;
    a /= b;
  }
  return ans;
}
template <class T>
T mceil(T a, T b) {
  if (a % b == 0)
    return a / b;
  else
    return a / b + 1;
}
template <class T>
T lcm(T a, T b) {
  return (a * b) / gcd<T>(a, b);
}
const long long infl = 1e18 + 5;
const int inf = 1e9 + 5;
void test_case() {
  int n, m;
  cin >> n >> m;
  long long x, k, y;
  cin >> x >> k >> y;
  vector<long long> a(n), b(m);
  for (int i = 0; i < (int)n; i++) cin >> a[i];
  for (int i = 0; i < (int)m; i++) cin >> b[i];
  if (m > n) {
    cout << -1;
    return;
  }
  int cur = 0;
  int found = true;
  vector<vector<pair<long long, long long>>> fin;
  for (int i = (int)(0); i < (int)(m); i++) {
    vector<pair<long long, long long>> temp;
    while (cur < n and a[cur] != b[i]) {
      temp.push_back(make_pair(a[cur], cur));
      cur++;
    }
    if (cur >= n) {
      found = false;
      break;
    }
    cur++;
    if (((int)(temp).size()) != 0) fin.push_back(temp);
  }
  if (!found) {
    cout << -1;
    return;
  }
  vector<pair<long long, long long>> temp;
  for (int i = (int)(cur); i < (int)(n); i++) {
    temp.push_back(make_pair(a[i], i));
  }
  if (((int)(temp).size()) != 0) fin.push_back(temp);
  long long ans = 0;
  ;
  if (k * y <= x) {
    for (auto &segment : fin) {
      long long l = segment[0].second - 1;
      long long r = segment.back().second + 1;
      if (l == -1)
        l = -infl;
      else
        l = a[l];
      if (r == n)
        r = -infl;
      else
        r = a[r];
      long long ma = max_element(segment.begin(), segment.end())->first;
      long long si = ((int)(segment).size());
      if (ma < l or ma < r) {
        ans += si * y;
      } else {
        if (si < k) {
          cout << -1;
          return;
        } else {
          ans += (si - k) * y + x;
        }
      }
    }
  } else {
    for (auto &segment : fin) {
      long long l = segment[0].second - 1;
      long long r = segment.back().second + 1;
      if (l == -1)
        l = -infl;
      else
        l = a[l];
      if (r == n)
        r = -infl;
      else
        r = a[r];
      long long ma = max_element(segment.begin(), segment.end())->first;
      long long si = ((int)(segment).size());
      if (si < k) {
        if (ma > r and ma > l) {
          cout << -1;
          return;
        } else {
          ans += si * y;
        }
      } else {
        ans += (si % k) * y + (si / k) * x;
      }
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int _;
  _ = 1;
  auto start = high_resolution_clock::now();
  cout << setprecision(20);
  while (_--) {
    test_case();
  }
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<milliseconds>(stop - start);
  return 0;
}

```