#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, a, b, k, f;
string s[N][2];
map<pair<string, string>, int> Cost;
char Buf[N];
string Read() {
  scanf("%s", Buf);
  return Buf;
}
int main() {
  cin >> n >> a >> b >> k >> f;
  for (int i = 1; i <= n; i++) {
    s[i][0] = Read();
    s[i][1] = Read();
  }
  for (int i = 1; i <= n; i++) {
    pair<string, string> S = make_pair(s[i][0], s[i][1]);
    if (S.first > S.second) swap(S.first, S.second);
    if (i > 1 && s[i][0] == s[i - 1][1])
      Cost[S] += b;
    else
      Cost[S] += a;
  }
  vector<int> v;
  for (auto S : Cost) v.push_back(S.second);
  sort(v.begin(), v.end(), greater<int>());
  int Ans = 0;
  for (int x : v) {
    if (k > 0) {
      if (x > f)
        Ans += f, k--;
      else
        Ans += x;
    } else {
      Ans += x;
    }
  }
  cout << Ans << endl;
}
