#include <bits/stdc++.h>
using std::pair;
using std::vector;
using lint = long long int;
using pii = std::pair<int, int>;
std::map<std::string, int> map;
int num(std::string s) {
  if (map.count(s) == 0) map[s] = map.size();
  return map[s];
}
char A[30], B[30];
int main(void) {
  int n, a, b, k, f;
  scanf("%d%d%d%d%d", &n, &a, &b, &k, &f);
  std::map<pii, int> cost;
  int before = -1;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s%s", A, B);
    int from = num(A);
    int to = num(B);
    int p = a;
    if (from == before) {
      p = b;
    }
    ans += p;
    before = to;
    if (from > to) std::swap(from, to);
    cost[{from, to}] += p;
  }
  vector<int> W;
  for (auto q : cost) {
    W.push_back(q.second);
  }
  std::sort(W.begin(), W.end(), std::greater<int>());
  for (int i = 0; i < k && i < W.size(); i++) {
    if (W[i] < f) break;
    ans -= (W[i] - f);
  }
  printf("%d", ans);
  return 0;
}
