#include <bits/stdc++.h>
using namespace std;
map<pair<string, string>, int> cost;
int sum = 0;
int n, a, b, k, f;
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> a >> b >> k >> f;
  string prev = "gugugu";
  for (int i = 1; i <= n; i++) {
    string u, v;
    cin >> u >> v;
    if (u == prev) {
      cost[make_pair(min(u, v), max(u, v))] += b;
      sum += b;
    } else {
      cost[make_pair(min(u, v), max(u, v))] += a;
      sum += a;
    }
    prev = v;
  }
  vector<int> a;
  for (auto v : cost) a.push_back(v.second);
  sort(a.begin(), a.end());
  for (int i = a.size() - 1; i >= int(a.size()) - k; i--) {
    if (i < 0) break;
    if (a[i] >= f) {
      sum -= a[i];
      sum += f;
    }
  }
  cout << sum;
  return 0;
}
