func_code_string: #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 ;   }   