#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> cost;
int main() {
  int n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  map<string, int> q;
  vector<pair<int, int> > arr;
  int m = 1;
  for (int i = 0; i < n; i++) {
    string s, s1;
    cin >> s;
    cin >> s1;
    if (q[s] == 0) {
      q[s] = m;
      m++;
    }
    if (q[s1] == 0) {
      q[s1] = m;
      m++;
    }
    arr.push_back(make_pair(q[s], q[s1]));
  }
  for (int i = 0; i < n; i++) {
    if (i != 0 && arr[i - 1].second == arr[i].first) {
      if (arr[i].first < arr[i].second)
        cost[arr[i]] += b;
      else
        cost[make_pair(arr[i].second, arr[i].first)] += b;
    } else {
      if (arr[i].first < arr[i].second)
        cost[arr[i]] += a;
      else
        cost[make_pair(arr[i].second, arr[i].first)] += a;
    }
  }
  vector<int> w;
  map<pair<int, int>, bool> used;
  for (int i = 0; i < n; i++) {
    if (!used[(arr[i].first < arr[i].second
                   ? arr[i]
                   : make_pair(arr[i].second, arr[i].first))]) {
      if (arr[i].first < arr[i].second)
        used[arr[i]] = true;
      else
        used[make_pair(arr[i].second, arr[i].first)] = true;
      if (arr[i].first < arr[i].second)
        w.push_back(-cost[arr[i]]);
      else
        w.push_back(-cost[make_pair(arr[i].second, arr[i].first)]);
    }
  }
  sort(w.begin(), w.end());
  int ans = 0;
  for (int i = 0; i < w.size(); i++) w[i] = -w[i];
  for (int i = 0; i < w.size(); i++) {
    ans += w[i];
  }
  for (int i = 0; i < min(k, (int)w.size()); i++) {
    if (w[i] >= f) {
      ans -= (w[i] - f);
    }
  }
  cout << ans << endl;
  return 0;
}
