#include <bits/stdc++.h>
using namespace std;
long long n, a, b, k, f, sum;
map<pair<string, string>, int> mp;
long long kk, cost[400000];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> a >> b >> k >> f;
  string last = "???";
  for (int i = 0; i < n; i++) {
    string t1, t2;
    cin >> t1 >> t2;
    if (mp.find(make_pair(t1, t2)) == mp.end()) {
      mp[make_pair(t1, t2)] = kk;
      mp[make_pair(t2, t1)] = kk;
      kk++;
    }
    if (last == t1) {
      cost[mp[make_pair(t1, t2)]] += b;
      sum += b;
    } else {
      cost[mp[make_pair(t1, t2)]] += a;
      sum += a;
    }
    last = t2;
  }
  sort(cost, cost + kk);
  reverse(cost, cost + kk);
  for (int i = 0; i < k; i++) {
    if (cost[i] > f) {
      sum -= cost[i];
      sum += f;
    }
  }
  cout << sum << endl;
  return 0;
}
