#include <bits/stdc++.h>
using namespace std;
template <typename T>
T prod(const T &a, const T &b, const T &mod) {
  return ((a % mod) * (b % mod)) % mod;
}
template <typename T>
T pow_(const T &a, const T &b) {
  if (!b) return 1;
  T p = pow_(a, b / 2);
  p *= p;
  return (b % 2) ? (p * a) : p;
}
template <typename T>
T modpow(const T &a, const T &b, const T &mod) {
  if (!b) return 1;
  T p = modpow(a, b / 2);
  p = prod(p, p);
  return (b % 2) ? (prod(p, a)) : p;
}
template <typename T>
T max(const T &a, const T &b, const T &c) {
  return max(a, max(b, c));
}
template <typename T>
T min(const T &a, const T &b, const T &c) {
  return min(a, min(b, c));
}
template <typename T>
void dbg(const vector<T> &a, int l, int r) {
  for (long long int i = l; i <= r; i++) cout << a[i] << " ";
  cout << endl;
}
template <typename T>
void dbg(const vector<T> &a) {
  for (long long int i = 0; i <= a.size() - 1; i++) cout << a[i] << " ";
  cout << endl;
}
vector<long long int> cost;
map<pair<string, string>, long long int> cnt;
void main_() {
  long long int n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  cost.resize(n);
  string pre = " ";
  long long int total = 0;
  for (long long int i = 0; i <= n - 1; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    if (pre == s1)
      cost[i] = b;
    else
      cost[i] = a;
    pre = s2;
    cnt[(make_pair(min(s1, s2), max(s1, s2)))] += cost[i];
    total += cost[i];
  }
  long long int ans = total;
  set<pair<long long int, pair<string, string> >,
      greater<pair<long long int, pair<string, string> > > >
      set_;
  for (auto it : cnt) {
    set_.insert(make_pair(it.second, it.first));
  }
  for (long long int i = 0; i <= k; i++) {
    long long int x = i;
    long long int cost = total;
    set<pair<long long int, pair<string, string> >,
        greater<pair<long long int, pair<string, string> > > >::iterator it;
    it = set_.begin();
    while (x && it != set_.end()) {
      long long int c = it->first;
      string s1 = it->second.first;
      string s2 = it->second.second;
      if (c > f) {
        cost = cost + f - c;
      }
      x--;
      it++;
    }
    ans = min(ans, cost);
  }
  cout << ans << endl;
}
int main() {
  { main_(); }
  return 0;
}
