#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
void solve() {
  long long n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  vector<pair<string, string>> vp;
  map<pair<string, string>, long long> mpp, mpp1;
  string s, t;
  for (long long i = 0; i < n; i += 1) {
    cin >> s >> t;
    if (i == 0) {
      mpp[{s, t}] += a;
    }
    vp.push_back({s, t});
  }
  for (long long i = 1; i < n; i += 1) {
    if (vp[i - 1].second == vp[i].first) {
      mpp[vp[i]] += b;
    } else {
      mpp[vp[i]] += a;
    }
  }
  vector<long long> val;
  for (auto vbn : mpp) {
    if (!mpp1[vbn.first]) {
      val.push_back(mpp[{vbn.first.first, vbn.first.second}] +
                    mpp[{vbn.first.second, vbn.first.first}]);
    }
    mpp1[vbn.first]++;
    mpp1[{vbn.first.second, vbn.first.first}]++;
  }
  sort((val).begin(), (val).end(), greater<long long>());
  for (long long i = 0; i < min(k, (long long)(val.size())); i += 1) {
    val[i] = min(val[i], f);
  }
  long long ans = 0;
  for (auto vbn : val) ans += vbn;
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tin = 1;
  while (tin--) {
    solve();
  }
  return 0;
}
