#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a, b, k, f, ans = 0;
  string sa, sb, sp;
  vector<int> v;
  cin >> n >> a >> b >> k >> f;
  map<pair<string, string>, int> mp;
  for (int i = 0; i < n; ++i) {
    cin >> sa >> sb;
    if (sa == sp)
      mp[{sa, sb}] += b;
    else
      mp[{sa, sb}] += a;
    mp[{sb, sa}] += 0;
    sp = sb;
  }
  while (!mp.empty()) {
    auto it = mp.begin();
    sa = it->first.first;
    sb = it->first.second;
    v.push_back(mp[{sa, sb}] + mp[{sb, sa}]);
    ans += v.back();
    mp.erase({sa, sb});
    mp.erase({sb, sa});
  }
  sort(v.begin(), v.end());
  while (k-- && !v.empty())
    if (f < v.back()) {
      ans += f - v.back();
      v.pop_back();
    }
  cout << ans;
}
