#include <bits/stdc++.h>
using namespace std;
int main() {
  map<pair<string, string>, int> m;
  long long int cost[301] = {0};
  int n, a, b, k, first, i, ind = 1;
  cin >> n >> a >> b >> k >> first;
  string pre, u, v, x, y;
  pre = "";
  cost[0] = INT_MAX;
  ind = 1;
  for (i = 0; i < n; i++) {
    cin >> u >> v;
    if (u.compare(v) < 0) {
      x = u;
      y = v;
    } else {
      x = v;
      y = u;
    }
    if (!m[make_pair(x, y)]) {
      m[make_pair(x, y)] = ind;
      ind++;
    }
    if (u == pre)
      cost[m[make_pair(x, y)]] += b;
    else
      cost[m[make_pair(x, y)]] += a;
    pre = v;
  }
  int cnt = 0, ans = 0;
  sort(cost, cost + ind);
  for (i = ind - 2; i >= 0; i--) {
    if (cnt >= k) break;
    if (cost[i] > first) {
      cnt++;
      cost[i] = first;
    } else
      break;
  }
  for (i = ind - 2; i >= 0; i--) ans += cost[i];
  cout << ans;
  return 0;
}
