#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, a, b, k, f;
  while (cin >> n >> a >> b >> k >> f) {
    int cost, nk = 0, sum = 0, label = 0, ad[305] = {0};
    map<pair<string, string>, int> dict;
    string pre;
    for (int i = 0; i < n; i++) {
      string from, to;
      cin >> from >> to;
      if (from == pre)
        cost = b;
      else
        cost = a;
      sum += cost;
      string b, g;
      b = from, g = to;
      if (b > g) swap(b, g);
      if (dict.find(make_pair(b, g)) == dict.end())
        dict[make_pair(b, g)] = label++;
      ad[dict[make_pair(b, g)]] += cost;
      pre = to;
    }
    sort(ad, ad + label, greater<int>());
    for (int i = 0; i < label; i++) {
      if (nk == k) break;
      if (ad[i] > f) {
        sum -= (ad[i] - f);
        nk++;
      }
    }
    cout << sum << "\n";
  }
  return 0;
}
