#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, k, f;
  scanf("%d %d %d %d %d", &n, &a, &b, &k, &f);
  int routeCount = 0;
  map<pair<string, string>, int> routeMap;
  vector<int> routes;
  int c = 0;
  bool isA;
  string oldb, sa, sb;
  for (int i = 0; i < n; i++) {
    oldb = sb;
    cin >> sa >> sb;
    if (oldb == sa)
      isA = false, c += b;
    else
      isA = true, c += a;
    bool swapped = false;
    if (sa > sb) {
      swap(sa, sb);
      swapped = true;
    }
    pair<string, string> route = make_pair(sa, sb);
    int routeID;
    if (routeMap.find(route) != routeMap.end())
      routeID = routeMap[route];
    else {
      routeMap.insert(make_pair(route, routeCount++));
      routeID = routeCount - 1;
      routes.push_back(0);
    }
    if (isA)
      routes[routeID] += a;
    else
      routes[routeID] += b;
    if (swapped) swap(sa, sb);
  }
  sort(routes.begin(), routes.end());
  reverse(routes.begin(), routes.end());
  int ans = c;
  for (int i = 1; i <= min((int)routes.size(), k); i++) {
    int tmp = c;
    for (int j = 0; j < i; j++) tmp -= routes[j];
    ans = min(ans, tmp + i * f);
  }
  printf("%d\n", ans);
  return 0;
}
