#include <bits/stdc++.h>
using namespace std;
map<pair<string, string>, int> mp;
void add(pair<string, string> aa, int bb) {
  if (aa.first.compare(aa.second) > 0) {
    swap(aa.first, aa.second);
  }
  mp[aa] += bb;
}
int main() {
  int n, a, b, k, f, i;
  cin >> n >> a >> b >> k >> f;
  string now;
  pair<string, string> next;
  for (i = 0; i < n; i++) {
    cin >> next.first >> next.second;
    if (now.compare(next.first) == 0)
      add(next, b);
    else
      add(next, a);
    now = next.second;
  }
  int ans = 0;
  vector<int> vec;
  for (auto &pp : mp) {
    vec.push_back(pp.second);
  }
  sort(vec.begin(), vec.end());
  for (i = vec.size() - 1; i >= 0; i--) {
    if (k > 0 && vec[i] > f)
      ans += f, k--;
    else
      ans += vec[i];
  }
  printf("%d\n", ans);
}
