#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  map<pair<string, string>, int> ticketSum;
  int totalSum = 0;
  string lastStop;
  for (int i = 0; i < n; i++) {
    string stopA, stopB;
    cin >> stopA >> stopB;
    int sum = (lastStop == stopA ? b : a);
    lastStop = stopB;
    totalSum += sum;
    if (stopA > stopB) swap(stopA, stopB);
    ticketSum[{stopA, stopB}] += sum;
  }
  vector<int> tickets;
  for (auto it = ticketSum.begin(); it != ticketSum.end(); it++) {
    tickets.push_back(it->second);
  }
  sort(tickets.begin(), tickets.end());
  while (!tickets.empty() && k && tickets.back() > f) {
    k--;
    totalSum -= tickets.back();
    totalSum += f;
    tickets.pop_back();
  }
  cout << totalSum;
}
