#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const double eps = 1e-8;
const int iinf = INT_MAX;
const long long linf = 2e18;
const double dinf = 1e30;
const int MOD = 1000000007;
inline int read() {
  int X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
void print(int x) {
  cout << x << '\n';
  exit(0);
}
void PRINT(string x) {
  cout << x << '\n';
  exit(0);
}
void douout(double x) { printf("%lf\n", x + 0.0000000001); }
map<pair<string, string>, int> mp;
int ans[500];
bool cmp(int a, int b) { return a > b; }
int main() {
  int n, a, b, k, f, i, j, x;
  scanf("%d%d%d%d%d", &n, &a, &b, &k, &f);
  string u, v;
  string uu, vv;
  uu = vv = "+";
  for (i = 1; i <= n; i++) {
    cin >> u >> v;
    if (u == vv)
      x = b;
    else
      x = a;
    uu = u, vv = v;
    if (u > v) swap(u, v);
    mp[make_pair(u, v)] += x;
  }
  map<pair<string, string>, int>::iterator it;
  int sum = 0;
  memset(ans, 0, sizeof(ans));
  for (it = mp.begin(), i = 0; it != mp.end(); it++, i++) {
    ans[i] = it->second;
    sum += ans[i];
  }
  sort(ans, ans + i, cmp);
  for (j = 0; j < k && j < i; j++)
    if (ans[j] > f) sum = sum - ans[j] + f;
  printf("%d\n", sum);
  return 0;
}
