#include <bits/stdc++.h>
using namespace std;
int n, a, b, k, f;
map<pair<string, string>, int> mapa;
string A, B;
int main() {
  scanf("%d %d %d %d %d", &n, &a, &b, &k, &f);
  string tmp = "---";
  for (int i = (0); i < int(n); i++) {
    cin >> A >> B;
    if (tmp != A)
      mapa[make_pair(min(A, B), max(A, B))] += a;
    else
      mapa[make_pair(min(A, B), max(A, B))] += b;
    tmp = B;
  }
  vector<int> v;
  for (map<pair<string, string>, int>::iterator it = mapa.begin();
       it != mapa.end(); it++)
    v.push_back(it->second);
  sort((v).begin(), (v).end());
  int sol = 0;
  while (k-- && !v.empty() && v.back() > f) {
    sol += f;
    v.pop_back();
  }
  for (int i = (0); i < int((int)v.size()); i++) sol += v[i];
  printf("%d\n", sol);
  return 0;
}
