#include <bits/stdc++.h>
using namespace std;
long long t, a, b, c, n, k, i, ans;
deque<pair<long long, long long> > dq;
string s, s1, p, q[305], q1[305];
map<string, bool> used;
vector<int long long> pr;
vector<pair<string, string> > v;
map<string, map<string, int long long> > d;
int main() {
  cin >> n >> a >> b >> k >> c;
  p = "";
  for (i = 1; i <= n; i++) {
    cin >> q[i] >> q1[i];
    s = q[i];
    s1 = q1[i];
    t = 1;
    if (s < s1) swap(s, s1);
    if (!d[s][s1]) v.push_back({s, s1});
    if (q[i] != p) t = 0;
    if (!t) {
      ans += a;
      d[s][s1] += a;
    }
    if (t) {
      ans += b;
      d[s][s1] += b;
    }
    p = q1[i];
  }
  for (i = 0; i < v.size(); i++) {
    pr.push_back(d[v[i].first][v[i].second]);
  }
  sort(pr.begin(), pr.end());
  reverse(pr.begin(), pr.end());
  int long long d = pr.size();
  for (i = 0; i < min(k, d); i++) {
    if (pr[i] > c) {
      ans -= pr[i];
      ans += c;
    } else
      break;
  }
  cout << ans << endl;
}
