#include <bits/stdc++.h>
using namespace std;
const int MAXN = 305;
int n, a, b, k, f;
string last;
map<pair<string, string>, int> M;
vector<int> V;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> a >> b >> k >> f;
  for (int i = 0; i < n; ++i) {
    string s, e;
    cin >> s >> e;
    int cost = (s == last) ? b : a;
    last = e;
    if (s > e) swap(s, e);
    M[{s, e}] += cost;
  }
  for (auto &p : M) {
    V.push_back(p.second);
  }
  sort(V.begin(), V.end());
  reverse(V.begin(), V.end());
  int ans = 0;
  for (int &c : V) {
    if (c > f && k) {
      --k;
      c = f;
    }
    ans += c;
  }
  cout << ans << '\n';
  return 0;
}
