#include <bits/stdc++.h>
int main() {
  int n, a, b, k, f;
  std::cin >> n >> a >> b >> k >> f;
  std::map<std::pair<std::string, std::string>, int> cost;
  std::string last;
  while (n--) {
    std::string s1, s2;
    std::cin >> s1 >> s2;
    if (s1 == last)
      cost[std::pair<std::string, std::string>(std::min(s1, s2),
                                               std::max(s1, s2))] += b;
    else
      cost[std::pair<std::string, std::string>(std::min(s1, s2),
                                               std::max(s1, s2))] += a;
    last = s2;
  }
  std::priority_queue<int> hp;
  for (auto a : cost) {
    hp.push(a.second);
  }
  int ans = 0;
  while (!hp.empty() && k && f < hp.top()) ans += f, hp.pop(), k--;
  while (!hp.empty()) ans += hp.top(), hp.pop();
  std::cout << ans << '\n';
}
