#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T re() {
  T N = 0;
  char c = getchar();
  bool neg = 0;
  for (; c < '0' || c > '9'; c = getchar()) neg |= c == '-';
  for (; c >= '0' && c <= '9'; c = getchar()) N = (N << 3) + (N << 1) + c - '0';
  return neg ? -N : N;
}
const int MX = 300;
int n, a, b, k, f;
pair<int, int> raw[MX + 5];
vector<int> chains[MX + 5];
unordered_map<string, int> name;
map<pair<int, int>, pair<int, int> > mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b >> k >> f;
  int nn = 0;
  for (int i = 1, cntr; i <= n; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    if (!name[s1]) name[s1] = ++cntr;
    if (!name[s2]) name[s2] = ++cntr;
    nn = max({nn, name[s1], name[s2]});
    raw[i] = {name[s1], name[s2]};
  }
  int cur_chain = 0;
  for (int i = 1; i <= n; i++) {
    if (cur_chain == 0 || chains[cur_chain].back() != raw[i].first) cur_chain++;
    if (chains[cur_chain].empty()) chains[cur_chain].push_back(raw[i].first);
    chains[cur_chain].push_back(raw[i].second);
  }
  for (int c = 1; c <= cur_chain; c++) {
    for (int i = 0, j = 1; j < chains[c].size(); i++, j++) {
      pair<int, int> pr = make_pair(chains[c][i], chains[c][j]);
      if (pr.first > pr.second) swap(pr.first, pr.second);
      if (i == 0) {
        mp[pr].first++;
      } else {
        mp[pr].second++;
      }
    }
  }
  vector<pair<int, int> > all;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    all.push_back(it->first);
  }
  sort(all.begin(), all.end(), [](pair<int, int> x, pair<int, int> y) {
    int tmp1 = mp[x].first * a + mp[x].second * b;
    int tmp2 = mp[y].first * a + mp[y].second * b;
    return tmp1 > tmp2;
  });
  long long ans = 0;
  for (int i = 0; i < all.size(); i++) {
    long long cost = mp[all[i]].first * a + mp[all[i]].second * b;
    if (i < k) {
      if (cost > f)
        ans += f;
      else
        ans += cost;
    } else {
      ans += cost;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
