#include <bits/stdc++.h>
using namespace std;
const int maxn = 305;
map<pair<int, int>, int> s;
map<string, int> Map;
int n, x, y, tx, ty, k, f, cnt = 0, last = -1, ans = 0, c[maxn], num = 0;
string a, b;
int main() {
  cin >> n >> x >> y >> k >> f;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    if (!Map[a]) Map[a] = ++cnt;
    if (!Map[b]) Map[b] = ++cnt;
    int tx = Map[a], ty = Map[b], cost = (tx == last) ? y : x;
    ans += cost;
    s[make_pair(min(tx, ty), max(tx, ty))] += cost;
    last = ty;
  }
  for (map<pair<int, int>, int>::iterator it = s.begin(); it != s.end(); it++)
    c[++num] = it->second;
  sort(c + 1, c + num + 1, greater<int>());
  for (int i = 1; i <= k; i++)
    if (c[i] <= f)
      break;
    else
      ans -= c[i] - f;
  cout << ans << endl;
  return 0;
}
