#include <bits/stdc++.h>
using namespace std;
int n, a, b, k, f;
map<string, int> m;
vector<int> v;
int main() {
  cin >> n >> a >> b >> k >> f;
  string p, q, prev = "";
  int cost = 0, curr;
  for (int i = 0; i < n; i++) {
    cin >> p >> q;
    curr = a;
    if (p == prev) curr = b;
    prev = q;
    if (p > q) swap(p, q);
    m[p + "|" + q] += curr;
    cost += curr;
  }
  for (auto i : m) {
    v.push_back(i.second);
  }
  sort(v.rbegin(), v.rend());
  for (int i : v) {
    if (k == 0) break;
    if (i > f) {
      cost -= (i - f);
      k--;
    } else
      break;
  }
  cout << cost << '\n';
}
