#include <bits/stdc++.h>
const int INF = 2 * 1e9;
const long long int MOD = 1000000007;
using namespace std;
void solve() {
  int n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  map<string, int> m;
  int j = 0;
  vector<pair<string, string>> p(n);
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> p[i].first >> p[i].second;
    if (m.count(p[i].first) == 0) {
      m[p[i].first] = j;
      j++;
    }
    if (m.count(p[i].second) == 0) {
      m[p[i].second] = j;
      j++;
    }
  }
  map<pair<int, int>, int> cnt;
  vector<pair<int, int>> v;
  for (int(i) = 0; (i) < (n); (i)++) {
    v.push_back({m[p[i].first], m[p[i].second]});
  }
  int ans = INT_MAX;
  set<pair<int, int>> buy;
  int curr = 0;
  for (int i = 0; i < n; i++) {
    if (i > 0 && v[i].first == v[i - 1].second) {
      curr += b;
      cnt[{min(v[i].first, v[i].second), max(v[i].first, v[i].second)}] += b;
    } else {
      curr += a;
      cnt[{min(v[i].first, v[i].second), max(v[i].first, v[i].second)}] += a;
    }
  }
  for (int j = 0; j <= k; j++) {
    curr = buy.size() * f;
    for (int i = 0; i < n; i++) {
      if (buy.count(
              {min(v[i].first, v[i].second), max(v[i].first, v[i].second)}))
        continue;
      if (i > 0 && v[i].first == v[i - 1].second)
        curr += b;
      else
        curr += a;
    }
    ans = min(ans, curr);
    pair<int, int> f;
    int mx = 0;
    for (auto x : cnt) {
      if (mx < x.second && buy.count(x.first) == 0) {
        mx = x.second;
        f = x.first;
      }
    }
    if (mx == 0) break;
    buy.insert({min(f.first, f.second), max(f.first, f.second)});
  }
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.fixed;
  cout.precision(12);
  solve();
  return 0;
}
