#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, A, B, K, F;
  cin >> N >> A >> B >> K >> F;
  long long T = 0;
  unordered_map<string, long long> cities;
  map<pair<long long, long long>, pair<long long, long long> > Trips;
  string prev = "";
  for (int i = 0; i < N; ++i) {
    string start, end;
    cin >> start >> end;
    if (cities[start] == 0) {
      cities[start] = ++T;
    }
    if (cities[end] == 0) {
      cities[end] = ++T;
    }
    if (i == 0) {
      int i = cities[start];
      int j = cities[end];
      Trips[{i, j}].first += 1;
      prev = end;
    } else {
      int i = min(cities[start], cities[end]),
          j = max(cities[start], cities[end]);
      if (prev.compare(start) == 0) {
        Trips[{i, j}].second += 1;
      } else {
        Trips[{i, j}].first += 1;
      }
      prev = end;
    }
  }
  long long ans = 0;
  vector<long long> costs;
  for (auto it : Trips) {
    long long x = it.second.first * A + it.second.second * B;
    costs.push_back(x);
  }
  sort(costs.begin(), costs.end(), greater<long long>());
  for (auto it : costs) {
    int x = it;
    if (it > F && K) {
      x = F;
      K--;
    }
    ans += x;
  }
  cout << ans << '\n';
  return 0;
}
