#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  map<pair<string, string>, int> input;
  vector<int> values;
  string last = " ";
  for (int i = 0; i < n; ++i) {
    string start, finish;
    cin >> start >> finish;
    int cost = 0;
    if (last == start) {
      cost = b;
    } else {
      cost = a;
    }
    last = finish;
    auto check1 = input.find({start, finish});
    auto check2 = input.find({finish, start});
    if (check1 != input.end()) {
      check1->second += cost;
      continue;
    }
    if (check2 != input.end()) {
      check2->second += cost;
      continue;
    }
    input.insert({{start, finish}, cost});
  }
  for (auto& a : input) {
    values.push_back(a.second);
  }
  sort(values.begin(), values.end());
  int count = 0;
  for (int i = values.size() - 1; i >= 0; --i) {
    if (values[i] > f && count < k) {
      count++;
      values[i] = f;
    }
  }
  int sum = 0;
  for (int i = 0; i < values.size(); ++i) {
    sum += values[i];
  }
  cout << sum;
}
