#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
int n, a, b, k, f, x[N], y[N];
int c[N][N];
int num;
map<string, int> q;
vector<int> v;
int get(const string &s) {
  if (q.find(s) == q.end()) {
    num++;
    q[s] = num;
  }
  return q[s];
}
int main() {
  cin >> n >> a >> b >> k >> f;
  num = 0;
  int prev = -1;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    x[i] = get(s1), y[i] = get(s2);
    int cur;
    if (x[i] == prev)
      cur = b;
    else
      cur = a;
    ans += cur;
    prev = y[i];
    c[x[i]][y[i]] += -cur;
    c[y[i]][x[i]] += -cur;
  }
  for (int i = 1; i <= 2 * n; i++) {
    for (int j = i + 1; j <= 2 * n; j++) {
      if (f + c[i][j] < 0) v.push_back(f + c[i][j]);
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < min((int)v.size(), k); i++) {
    ans += v[i];
  }
  cout << ans;
  return 0;
}
