#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> co;
map<string, int> Hash;
vector<int> ansv;
string st, ed;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  int cnt = 0, last = -1, ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> st >> ed;
    if (!Hash.count(st)) Hash[st] = ++cnt;
    if (!Hash.count(ed)) Hash[ed] = ++cnt;
    int ty = Hash[ed];
    int tx = Hash[st];
    if (tx == last) {
      co[make_pair(min(tx, ty), max(tx, ty))] += min(a, b);
      ans += min(a, b);
    } else {
      co[make_pair(min(tx, ty), max(tx, ty))] += a;
      ans += a;
    }
    last = ty;
  }
  for (auto x : co) ansv.push_back(x.second);
  sort(ansv.rbegin(), ansv.rend());
  for (int i = 0; i < k && i < ansv.size(); i++) {
    if (ansv[i] <= f) break;
    ans -= ansv[i];
    ans += f;
  }
  cout << ans << endl;
}
