#include <bits/stdc++.h>
using namespace std;
void doRoutine() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
map<pair<string, string>, int64_t> cnt;
void add(string a, string b, int64_t d) {
  if (a > b) {
    swap(a, b);
  }
  cnt[{a, b}] += d;
}
signed main() {
  doRoutine();
  int64_t n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  string s0, t0, s, t;
  cin >> s0 >> t0;
  add(s0, t0, a);
  while (cin >> s >> t) {
    if (s == t0) {
      add(s, t, b);
    } else {
      add(s, t, a);
    }
    s0 = s;
    t0 = t;
  }
  vector<int64_t> arr;
  for (auto pr : cnt) {
    arr.push_back(pr.second);
  }
  sort(arr.rbegin(), arr.rend());
  int64_t ans = 0;
  for (int64_t i = 0; i < arr.size(); ++i) {
    if (i < k && arr[i] > f) {
      ans += f;
    } else {
      ans += arr[i];
    }
  }
  cout << ans << endl;
  return 0;
}
