#include <bits/stdc++.h>
using namespace std;
long long int n, a, b, k, f;
string u, v;
map<string, map<string, long long int> > mp;
int main() {
  ios::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n >> a >> b >> k >> f;
  string last = "";
  for (int i = 0; i < n; i++) {
    cin >> u >> v;
    if (u == last) {
      last = v;
      if (u > v) swap(u, v);
      mp[u][v] += b;
    } else {
      last = v;
      if (u > v) swap(u, v);
      mp[u][v] += a;
    }
  }
  vector<long long int> cst;
  long long int ans = 0;
  for (auto it : mp) {
    for (auto it2 : it.second) {
      cst.push_back(it2.second);
      ans += it2.second;
    }
  }
  sort(cst.begin(), cst.end());
  for (int i = cst.size() - 1; k > 0 && i >= 0; i--) {
    if (f < cst[i]) {
      k--;
      ans -= cst[i];
      ans += f;
    }
  }
  cout << ans << endl;
}
