#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  int prev = -1;
  map<string, int> m;
  map<pair<int, int>, int> total;
  int cnt = 0;
  auto getMap = [&](string s) {
    if (m.find(s) != m.end()) return;
    m[s] = cnt++;
  };
  for (int i = 0; i < n; ++i) {
    string aa, bb;
    cin >> aa >> bb;
    getMap(aa);
    getMap(bb);
    auto normalized = make_pair(min(m[aa], m[bb]), max(m[aa], m[bb]));
    if (m[aa] == prev) {
      total[normalized] += b;
    } else {
      total[normalized] += a;
    }
    prev = m[bb];
  }
  vector<int> costs;
  int ans = 0;
  for (auto temp : total) {
    costs.push_back(temp.second);
    ans += temp.second;
  }
  sort(costs.rbegin(), costs.rend());
  for (int i = 0; i < min(k, int(costs.size())); ++i) {
    ans -= max(0, costs[i] - f);
  }
  cout << ans << "\n";
}
