#include <bits/stdc++.h>
using namespace std;
int n, a, b, k, f;
map<pair<int, int>, int> mp;
map<string, int> mp2;
vector<int> v;
int main() {
  scanf("%d%d%d%d%d", &n, &a, &b, &k, &f);
  int tot = 0;
  int ans = 0, last = 0;
  for (int i = 1; i <= n; i++) {
    string x, y;
    cin >> x >> y;
    if (!mp2[x]) mp2[x] = ++tot;
    if (!mp2[y]) mp2[y] = ++tot;
    int tx = mp2[x], ty = mp2[y], cost = (tx == last) ? b : a;
    ans += cost;
    mp[make_pair(min(tx, ty), max(tx, ty))] += cost;
    last = ty;
  }
  for (map<pair<int, int>, int>::iterator it = mp.begin(); it != mp.end();
       it++) {
    v.push_back(it->second);
  }
  sort(v.begin(), v.end(), greater<int>());
  for (int i = 0; i < k; i++) {
    if (v[i] <= f)
      break;
    else
      ans -= v[i] - f;
  }
  printf("%d\n", ans);
  return 0;
}
