#include <bits/stdc++.h>
using namespace std;
long long factorial(long long n) {
  return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
int max3(int a, int b, int c) { return max(a, max(c, b)); }
int gcd(int a, int b) {
  if (a == 0) {
    return b;
  } else {
    return gcd(b % a, a);
  }
}
long long power(long long a, long long n) {
  if (n == 1)
    return a;
  else if (n == 0)
    return 1;
  else {
    long long r = power(a, n / 2);
    if (n % 2 == 0)
      return r * r;
    else
      return r * a * r;
  }
}
long long nCr(long long n, long long r) {
  return ((factorial(n)) / (factorial(n - r) * factorial(r)));
}
void dfs(vector<vector<int>> &v, vector<int> &check, int start) {
  check[start - 1] = 1;
  for (long long j = 0; j < v[start - 1].size(); j++) {
    if (!check[v[start - 1][j] - 1]) {
      dfs(v, check, v[start - 1][j]);
    }
  }
}
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int printDivisors(int n) {
  int num = INT_MIN;
  for (int i = 1; i <= sqrt(n); i += 2) {
    if (n % i == 0) {
      if (n / i == i) {
        num = max(num, i);
      } else {
        if (i == 1) {
          num = max(num, i);
        } else {
          num = max(num, max(n / i, i));
        }
      }
    }
  }
  return num;
}
void initialize(int Arr[], int N, int Size[]) {
  for (int i = 0; i < N; i++) {
    Arr[i] = i;
    Size[i] = 1;
  }
}
int root(int Arr[], int i) {
  while (Arr[i] != i) {
    i = Arr[i];
  }
  return i;
}
void Union(int Arr[], int A, int B, int Size[]) {
  int root_A = root(Arr, A);
  int root_B = root(Arr, B);
  if (root_A != root_B) {
    if (Size[root_B] > Size[root_A]) {
      Arr[root_A] = root_B;
      Size[root_B] += Size[root_A];
    } else {
      Arr[root_B] = root_A;
      Size[root_A] += Size[root_B];
    }
  }
}
bool Find(int Arr[], int A, int B) {
  if (root(Arr, A) == root(Arr, B))
    return true;
  else
    return false;
}
int calculate() { return 0; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long k, x, y;
  cin >> x >> k >> y;
  int a[n];
  int b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int j = 0; j < m; j++) {
    cin >> b[j];
  }
  int pointer1 = 0, pointer2 = 0;
  vector<int> pos;
  pos.push_back(-1);
  while (pointer1 < n and pointer2 < m) {
    if (a[pointer1] == b[pointer2]) {
      pos.push_back(pointer1);
      pointer1++;
      pointer2++;
    } else
      pointer1++;
  }
  pos.push_back(n);
  if (pointer2 != m) {
    cout << -1;
    exit(0);
  }
  long long cost = 0;
  for (int i = 0; i < (pos.size() - 1); i++) {
    if ((pos[i + 1] - pos[i]) < 2) {
      continue;
    } else {
      long long r, l, num;
      if (((i == 0) and (pos[i + 1] != 0))) {
        num = a[pos[i + 1]];
      } else if ((i == (pos.size() - 2))) {
        num = a[pos[i]];
      } else {
        r = a[pos[i + 1]];
        l = a[pos[i]];
        num = max(l, r);
      }
      long long diff = pos[i + 1] - pos[i] - 1;
      vector<int> list;
      for (int j = pos[i] + 1; j < pos[i + 1]; j++) {
        list.push_back(a[j]);
      }
      sort(list.begin(), list.end());
      long long highest = list[list.size() - 1];
      if (diff % k != 0) {
        if (diff / k == 0) {
          if (num < highest) {
            cout << -1;
            exit(0);
          }
        }
        cost += ((diff % k) * y);
      }
      long long left = diff / k;
      if (highest < num) {
        if (x > (y * k)) {
          cost += (y * k * left);
        } else {
          cost += (x * left);
        }
      } else {
        if (left > 1) {
          if (x > (y * k)) {
            cost += (y * k * (left - 1));
            cost += x;
          } else {
            cost += (x * left);
          }
        } else {
          cost += (x * left);
        }
      }
    }
  }
  cout << cost;
  return 0;
}

### Prompt

Please formulate 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;
long long factorial(long long n) {
  return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
int max3(int a, int b, int c) { return max(a, max(c, b)); }
int gcd(int a, int b) {
  if (a == 0) {
    return b;
  } else {
    return gcd(b % a, a);
  }
}
long long power(long long a, long long n) {
  if (n == 1)
    return a;
  else if (n == 0)
    return 1;
  else {
    long long r = power(a, n / 2);
    if (n % 2 == 0)
      return r * r;
    else
      return r * a * r;
  }
}
long long nCr(long long n, long long r) {
  return ((factorial(n)) / (factorial(n - r) * factorial(r)));
}
void dfs(vector<vector<int>> &v, vector<int> &check, int start) {
  check[start - 1] = 1;
  for (long long j = 0; j < v[start - 1].size(); j++) {
    if (!check[v[start - 1][j] - 1]) {
      dfs(v, check, v[start - 1][j]);
    }
  }
}
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int printDivisors(int n) {
  int num = INT_MIN;
  for (int i = 1; i <= sqrt(n); i += 2) {
    if (n % i == 0) {
      if (n / i == i) {
        num = max(num, i);
      } else {
        if (i == 1) {
          num = max(num, i);
        } else {
          num = max(num, max(n / i, i));
        }
      }
    }
  }
  return num;
}
void initialize(int Arr[], int N, int Size[]) {
  for (int i = 0; i < N; i++) {
    Arr[i] = i;
    Size[i] = 1;
  }
}
int root(int Arr[], int i) {
  while (Arr[i] != i) {
    i = Arr[i];
  }
  return i;
}
void Union(int Arr[], int A, int B, int Size[]) {
  int root_A = root(Arr, A);
  int root_B = root(Arr, B);
  if (root_A != root_B) {
    if (Size[root_B] > Size[root_A]) {
      Arr[root_A] = root_B;
      Size[root_B] += Size[root_A];
    } else {
      Arr[root_B] = root_A;
      Size[root_A] += Size[root_B];
    }
  }
}
bool Find(int Arr[], int A, int B) {
  if (root(Arr, A) == root(Arr, B))
    return true;
  else
    return false;
}
int calculate() { return 0; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long k, x, y;
  cin >> x >> k >> y;
  int a[n];
  int b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int j = 0; j < m; j++) {
    cin >> b[j];
  }
  int pointer1 = 0, pointer2 = 0;
  vector<int> pos;
  pos.push_back(-1);
  while (pointer1 < n and pointer2 < m) {
    if (a[pointer1] == b[pointer2]) {
      pos.push_back(pointer1);
      pointer1++;
      pointer2++;
    } else
      pointer1++;
  }
  pos.push_back(n);
  if (pointer2 != m) {
    cout << -1;
    exit(0);
  }
  long long cost = 0;
  for (int i = 0; i < (pos.size() - 1); i++) {
    if ((pos[i + 1] - pos[i]) < 2) {
      continue;
    } else {
      long long r, l, num;
      if (((i == 0) and (pos[i + 1] != 0))) {
        num = a[pos[i + 1]];
      } else if ((i == (pos.size() - 2))) {
        num = a[pos[i]];
      } else {
        r = a[pos[i + 1]];
        l = a[pos[i]];
        num = max(l, r);
      }
      long long diff = pos[i + 1] - pos[i] - 1;
      vector<int> list;
      for (int j = pos[i] + 1; j < pos[i + 1]; j++) {
        list.push_back(a[j]);
      }
      sort(list.begin(), list.end());
      long long highest = list[list.size() - 1];
      if (diff % k != 0) {
        if (diff / k == 0) {
          if (num < highest) {
            cout << -1;
            exit(0);
          }
        }
        cost += ((diff % k) * y);
      }
      long long left = diff / k;
      if (highest < num) {
        if (x > (y * k)) {
          cost += (y * k * left);
        } else {
          cost += (x * left);
        }
      } else {
        if (left > 1) {
          if (x > (y * k)) {
            cost += (y * k * (left - 1));
            cost += x;
          } else {
            cost += (x * left);
          }
        } else {
          cost += (x * left);
        }
      }
    }
  }
  cout << cost;
  return 0;
}

```