#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n = 0, a = 0, b = 0, k = 0, f = 0;
  string s1, s2, pre;
  cin >> n >> a >> b >> k >> f;
  map<string, int> cMap;
  while (n--) {
    cin >> s1 >> s2;
    int cost = a;
    if (s1 == pre) {
      cost = b;
    }
    pre = s2;
    if (s1 > s2) {
      swap(s1, s2);
    }
    cMap[s1 + "->" + s2] += cost;
  }
  priority_queue<int> cq;
  for (auto cv : cMap) {
    cq.push(cv.second);
  }
  int res = 0;
  while (!cq.empty()) {
    if (k && cq.top() > f) {
      res += f;
      --k;
    } else {
      res += cq.top();
    }
    cq.pop();
  }
  printf("%d", res);
  return 0;
}
