#include <bits/stdc++.h>
using namespace std;
map<pair<string, string>, int> cnt;
string s, t, last;
int c[305];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b, k, f, tot, ans;
  cin >> n >> a >> b >> k >> f;
  for (int i = 1, flag = 0, cost; i <= n; i++) {
    cin >> s >> t;
    if (i != 1 && s == last)
      cost = b;
    else
      cost = a;
    last = t;
    if (s > t) swap(s, t);
    cnt[{s, t}] += cost;
  }
  tot = 0;
  for (auto it : cnt) c[++tot] = it.second;
  sort(c + 1, c + tot + 1);
  ans = 0;
  for (int i = tot; i >= max(tot - k + 1, 1); i--) ans += min(c[i], f);
  for (int i = 1; i < max(tot - k + 1, 1); i++) ans += c[i];
  printf("%d\n", ans);
  return 0;
}
