#include <bits/stdc++.h>
using namespace std;
int n, a, b, k, f;
struct P {
  string s, t;
  int p;
} pp[333];
map<pair<string, string>, int> ma;
inline bool cmp(const P& a, const P& b) { return a.p > b.p; }
int main() {
  scanf("%d %d %d %d %d", &n, &a, &b, &k, &f);
  string tmp = "";
  int cnt = 0;
  for (int i = 1; i < (n + 1); i++) {
    string s, t;
    cin >> s >> t;
    int price = tmp == s ? b : a;
    tmp = t;
    if (s > t) swap(s, t);
    int pos = 0;
    if (ma.count(make_pair(s, t)))
      pos = ma[make_pair(s, t)];
    else {
      pos = ++cnt;
      ma[make_pair(s, t)] = cnt;
    }
    pp[pos].p += price;
  }
  sort(pp + 1, pp + 1 + cnt, cmp);
  int ans = 0;
  for (int i = 1; i <= cnt; i++) {
    if (k == 0 || f > pp[i].p)
      ans += pp[i].p;
    else {
      ans += f;
      k--;
    }
  }
  cout << ans << endl;
}
