#include <bits/stdc++.h>
using namespace std;
const int N = 102;
pair<int, int> ar[N];
bool used[N];
vector<deque<int>> a;
long long binpow(long long a, long long p, long long b) {
  long long n = p;
  long long res = 1;
  while (n) {
    if (n & 1) res = ((res % b) * (a % b)) % b;
    a = (a * a) % b;
    n >>= 1;
  }
  return res;
}
char query(int l1, int r1, int l2, int r2) {
  cout << "! " << (r1 - l1 + 1) << endl;
  for (; l1 <= r1; l1++) cout << l1 << " ";
  cout << endl;
  for (; l2 <= r2; l2++) cout << l2 << " ";
  cout.flush();
  char c;
  cin >> c;
  return c;
}
void fastio() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
};
struct Cand {
  int index;
  int col;
  int last;
};
int main() {
  map<pair<string, string>, int> mp;
  fastio();
  int n, a, b, k, f;
  cin >> n >> a >> b >> k >> f;
  string s1, s2, last = "####";
  for (int i = 0; i < n; i++) {
    cin >> s1 >> s2;
    pair<string, string> p = {s1, s2};
    if (p.first > p.second) swap(p.first, p.second);
    mp[p] += s1 == last ? b : a;
    last = s2;
  }
  vector<int> v;
  for (auto x : mp) v.push_back(x.second);
  sort(v.begin(), v.end());
  int ans = 0;
  for (int i = v.size() - 1; i >= 0; i--) {
    if (v[i] > f && k) {
      ans += f;
      k--;
    } else
      ans += v[i];
  }
  cout << ans;
  return 0;
}
