#include <bits/stdc++.h>
using namespace std;
const int N = 200200;
const int mod = 1e9 + 7;
int n, a, b, k, f;
string from[N], to[N];
map<pair<string, string>, int> C;
int ans = 0;
int main() {
  ios::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];
    int cost = a;
    if (from[i] == to[i - 1]) cost = b;
    string x = min(from[i], to[i]);
    string y = max(from[i], to[i]);
    C[make_pair(x, y)] += cost;
    ans += cost;
  }
  multiset<int> e;
  for (auto x : C) {
    string v = x.first.first, u = x.first.second;
    int all = x.second;
    if (all > f) e.insert(all - f);
  }
  while (k > 0 && !e.empty()) {
    auto it = (--e.end());
    ans -= *it;
    e.erase(it);
    k--;
  }
  cout << ans;
  return 0;
}
