#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, A, b, k, f, i;
  cin >> n >> A >> b >> k >> f;
  map<pair<string, string>, long long> m;
  pair<string, string> a[n];
  for (i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  pair<string, string> x;
  x = a[0];
  m[x] += A;
  for (i = 1; i < n; i++) {
    x = a[i];
    long long cost = A;
    if (x.first == a[i - 1].second) cost = b;
    if (m[x] == 0) {
      string temp = x.first;
      x.first = x.second;
      x.second = temp;
    }
    m[x] += cost;
  }
  map<pair<string, string>, long long>::iterator it;
  vector<long long> v;
  for (it = m.begin(); it != m.end(); it++) {
    if (it->second != 0) v.push_back(it->second);
  }
  sort(v.begin(), v.end());
  long long ans = 0;
  for (i = v.size() - 1; i >= 0; i--) {
    if (v[i] > f && k > 0) {
      ans += f;
      k--;
    } else {
      ans += v[i];
    }
  }
  cout << ans << '\n';
}
