#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, B, K, F, total = 0;
  cin >> N >> A >> B >> K >> F;
  string x, y, last;
  map<string, int> T;
  for (int i = 0; i < N; ++i) {
    cin >> x >> y;
    int sum = (last == x) ? B : A;
    last = y;
    if (x > y) {
      swap(x, y);
    }
    T[x + "_" + y] += sum;
    total += sum;
  }
  vector<int> s;
  for (auto x : T) {
    s.push_back(x.second);
  }
  sort(s.begin(), s.end());
  int cnt = s.size() - 1;
  for (int i = 0; i < K && cnt >= 0; ++i) {
    if (s[cnt] > F) {
      total += F - s[cnt--];
    }
  }
  cout << total << endl;
  return 0;
}
