#include <bits/stdc++.h>
using namespace std;
map<pair<string, string>, int> re;
int getId(string a, string b) {
  if (a > b) a.swap(b);
  auto it = re.find(make_pair(a, b));
  if (it == re.end()) {
    int res = (int)re.size();
    return re[make_pair(a, b)] = res;
  }
  return it->second;
}
int n, a, b, k, f;
string A[333], B[333];
int cnt[333];
void load() {
  cin >> n >> a >> b >> k >> f;
  for (int i = 0; i < n; i++) {
    cin >> A[i] >> B[i];
  }
}
void solve() {
  string last;
  for (int i = 0; i < n; i++) {
    int id = getId(A[i], B[i]);
    if (A[i] == last)
      cnt[id] += b;
    else
      cnt[id] += a;
    last = B[i];
  }
  n = (int)re.size();
  sort(cnt, cnt + n);
  reverse(cnt, cnt + n);
  int ans = accumulate(cnt, cnt + n, 0);
  for (int i = 0; i < min(n, k); i++) {
    if (f < cnt[i]) {
      ans -= cnt[i];
      ans += f;
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  load();
  solve();
  return 0;
}
