#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 18;
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
map<pair<string, string>, int> Mx;
int ch(string a, string b) {
  if (a > b) swap(a, b);
  auto u = make_pair(a, b);
  if (Mx.count(u)) return Mx[u];
  int t = Mx.size() + 1;
  return Mx[u] = t;
}
string in[305][2];
int val[305];
long long tot[605];
int main() {
  int N, A, B, K, F, i, j, k;
  scanf("%d %d %d %d %d", &N, &A, &B, &K, &F);
  for (i = 1; i <= N; i++) cin >> in[i][0] >> in[i][1];
  for (i = 1; i <= N; i++) {
    val[i] = A;
    if (i != 1 && in[i][0] == in[i - 1][1]) val[i] = B;
    tot[ch(in[i][0], in[i][1])] += val[i];
  }
  vector<long long> Vu;
  for (i = 1; i <= Mx.size(); i++) Vu.push_back(tot[i]);
  sort((Vu).begin(), (Vu).end(),
       [](long long a, long long b) { return a > b; });
  for (i = 0; i < Vu.size() && i < K; i++) Vu[i] = min(Vu[i], (long long)F);
  long long ans = 0;
  for (auto it : Vu) ans += it;
  return !printf("%lld\n", ans);
}
