#include <bits/stdc++.h>
using namespace std;
const int Max = 310;
map<string, int> mp;
vector<int> v;
int main() {
  int n, a, b, k, f, cost;
  string s1(""), s2(""), s3(""), temp("");
  cin >> n >> a >> b >> k >> f;
  for (int i = 1; i <= n; i++) {
    cin >> s1 >> s2;
    temp = min(s1, s2) + "*" + max(s1, s2);
    if (s1 == s3) {
      cost = b;
    } else {
      cost = a;
    }
    s3 = s2;
    mp[temp] = mp[temp] + cost;
  }
  map<string, int>::iterator it;
  for (it = mp.begin(); it != mp.end(); it++) {
    v.push_back(it->second);
  }
  sort(v.begin(), v.end(), greater<int>());
  int len = k > v.size() ? v.size() : k;
  for (int i = 0; i < len; i++) {
    if (v[i] > f) {
      v[i] = f;
    } else {
      break;
    }
  }
  int ans = 0;
  for (int i = 0; i < v.size(); i++) {
    ans += v[i];
  }
  cout << ans << endl;
  return 0;
}
