#include <bits/stdc++.h>
long long int M = 1e9 + 7;
void MultL(long long int &a, long long int b) { a = (a * b) % M; }
void AddL(long long int &a, long long int b) { a = (a + (b + M)) % M; }
long long int Mult(long long int a, long long int b) { return (a * b) % M; }
long long int Add(long long int a, long long int b) {
  return (a + (b + M)) % M;
}
using namespace std;
int main() {
  int n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  map<pair<string, string>, int> ma;
  string prev = "";
  for (int i = 0; i < n; ++i) {
    string x1;
    string x2;
    cin >> x1 >> x2;
    if (prev == x1) {
      prev = x2;
      if (x1 > x2) swap(x1, x2);
      ma[{x1, x2}] += b;
    } else {
      prev = x2;
      if (x1 > x2) swap(x1, x2);
      ma[{x1, x2}] += a;
    }
  }
  vector<int> cost;
  for (auto e : ma) {
    cost.push_back(e.second);
  }
  sort(cost.rbegin(), cost.rend());
  for (int i = 0; i < cost.size(); ++i) {
    if (k > 0 && cost[i] > f) {
      cost[i] = f;
      --k;
    }
  }
  int res = accumulate(cost.begin(), cost.end(), 0);
  cout << res << endl;
  return 0;
}
