#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
int n, a, b, k, f;
string from[N], to[N];
int cost[N];
map<pair<string, string>, int> q;
int all[N], sz = 0;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> a >> b >> k >> f;
  for (int i = 1; i <= n; ++i) {
    cin >> from[i] >> to[i];
    cost[i] = a;
    if (i > 1 && from[i] == to[i - 1]) cost[i] = b;
    q[make_pair(min(from[i], to[i]), max(from[i], to[i]))] += cost[i];
  }
  for (auto it = q.begin(); it != q.end(); ++it) {
    all[++sz] = it->second;
  }
  sort(all + 1, all + 1 + sz);
  reverse(all + 1, all + 1 + sz);
  int ans = 0;
  for (int i = 1; i <= sz; ++i) {
    if (k > 0 && all[i] > f) {
      all[i] = f;
      --k;
    }
  }
  for (int i = 1; i <= sz; ++i) ans += all[i];
  cout << ans << endl;
  return 0;
}
