#include <bits/stdc++.h>
using namespace std;
const int block_size = 320;
const long long mod = 1e9 + 7;
const long double eps = 1e-9;
const int inf = mod;
const double PI = atan(1) * 4;
template <typename T>
inline int sign(const T &a) {
  if (a < 0) return -1;
  if (a > 0) return 1;
  return 0;
}
template <typename T>
inline void in(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
long long twop(int x) { return 1LL << x; }
template <typename A, typename B>
inline void in(A &x, B &y) {
  in(x);
  in(y);
}
template <typename A, typename B, typename C>
inline void in(A &x, B &y, C &z) {
  in(x);
  in(y);
  in(z);
}
template <typename A, typename B, typename C, typename D>
inline void in(A &x, B &y, C &z, D &xx) {
  in(x);
  in(y);
  in(z);
  in(xx);
}
template <class T>
void upd(T &a, T b) {
  a = max(a, b);
}
map<pair<string, string>, int> cost;
pair<string, string> getPair(string a, string b) {
  if (a > b) swap(a, b);
  return make_pair(a, b);
}
long long n, a, b, k, f;
int main() {
  cin >> n >> a >> b >> k >> f;
  string last = "";
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    string sa, sb;
    cin >> sa >> sb;
    int c = (sa == last) ? b : a;
    last = sb;
    cost[getPair(sa, sb)] += c;
    ans += c;
  }
  vector<int> v;
  for (auto i : cost) v.push_back(i.second);
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (auto i : v) {
    if (i > f && k-- > 0) {
      ans -= (i - f);
    }
  }
  cout << ans << endl;
  return 0;
}
