#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, k, f, ans = 0;
  scanf("%d%d%d%d%d", &n, &a, &b, &k, &f);
  map<string, int> v;
  vector<string> in;
  vector<int> vals;
  for (int i = 0; i < n; i++) {
    string s1, s2;
    cin >> s1;
    scanf(" ");
    cin >> s2;
    in.push_back(s1 + ' ' + s2);
  }
  v.emplace(in[0], a);
  for (int i = 1; i < n; i++) {
    string cur = in[i], curb = cur.substr(0, cur.find_first_of(' ')),
           cure = cur.substr(cur.find_first_of(' ') + 1,
                             cur.length() - cur.find_first_of(' ') - 1);
    string curr = cure + ' ' + curb;
    string prev = in[i - 1],
           preve = prev.substr(prev.find_first_of(' ') + 1,
                               prev.length() - prev.find_first_of(' ') - 1);
    int pr;
    if (preve == curb) {
      pr = b;
    } else
      pr = a;
    auto c = v.find(cur);
    auto d = v.find(curr);
    if (c == v.end() && d == v.end()) {
      v.emplace(cur, pr);
    } else if (c == v.end()) {
      v[curr] += pr;
    } else {
      v[cur] += pr;
    }
  }
  for (const auto& val : v) {
    vals.push_back(val.second);
  }
  sort(vals.begin(), vals.end(), greater<int>());
  for (int i = 0; i < vals.size(); i++) {
    if ((vals[i] > f) && (k != 0)) {
      ans += f;
      k--;
    } else {
      ans += vals[i];
    }
  }
  printf("%d", ans);
  return 0;
}
