#include <bits/stdc++.h>
using namespace std;
int n, a, b, k, f, suma, cost[610][610], castig[90010], nr, k1;
string s, s1, s2, s3;
map<string, int> m;
int main() {
  cin >> n >> a >> b >> k >> f;
  cin >> s >> s1;
  if (m.find(s) == m.end()) m.insert({s, ++nr});
  if (m.find(s1) == m.end()) m.insert({s1, ++nr});
  cost[m[s]][m[s1]] = a;
  cost[m[s1]][m[s]] = a;
  for (int i = 2; i <= n; i++) {
    cin >> s2 >> s3;
    if (m.find(s2) == m.end()) m.insert({s2, ++nr});
    if (m.find(s3) == m.end()) m.insert({s3, ++nr});
    if (s2 == s1) {
      cost[m[s2]][m[s3]] += b;
      cost[m[s3]][m[s2]] += b;
    } else {
      cost[m[s2]][m[s3]] += a;
      cost[m[s3]][m[s2]] += a;
    }
    s = s2;
    s1 = s3;
  }
  for (int i = 1; i <= nr; i++) {
    for (int j = i + 1; j <= nr; j++) {
      if (cost[i][j] > f) {
        castig[++k1] = cost[i][j] - f;
      }
      suma += cost[i][j];
    }
  }
  sort(castig + 1, castig + 1 + k1);
  for (int i = k1; i >= max(1, k1 - k + 1); i--) {
    suma -= castig[i];
  }
  cout << suma;
  return 0;
}
