#include <bits/stdc++.h>
using namespace std;
int a, b, n, k, f;
int c[1009][1009];
string s, ss;
map<string, int> m;
int cur;
int main() {
  cin >> n >> a >> b >> k >> f;
  int las = -1;
  for (int i = 0; i < n; i++) {
    cin >> s >> ss;
    int x, y;
    if (m[s])
      x = m[s];
    else {
      cur++;
      m[s] = cur;
      x = cur;
    }
    if (m[ss])
      y = m[ss];
    else {
      cur++;
      m[ss] = cur;
      y = cur;
    }
    if (las == x)
      c[min(x, y)][max(x, y)] += b;
    else
      c[min(x, y)][max(x, y)] += a;
    las = y;
  }
  vector<int> v;
  int ans = 0;
  for (int i = 0; i <= cur; i++) {
    for (int j = 0; j <= cur; j++) {
      if (c[i][j]) {
        v.push_back(c[i][j]);
      }
    }
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  int sz = v.size();
  for (int i = 0; i < min(k, sz); i++) {
    if (v[i] > f)
      v[i] = f;
    else
      break;
  }
  for (int i = 0; i < v.size(); i++) {
    ans += v[i];
  }
  cout << ans;
}
