#include <bits/stdc++.h>
using namespace std;
map<string, bool> flag;
map<string, int> m1, m;
string strl[1000], strr[1000];
int g[1000], v[1000];
int main() {
  int n, a, b, k, f, q = 0;
  long long sum = 0;
  cin >> n >> a >> b >> k >> f;
  cin >> strl[1] >> strr[1];
  if (strl[1] > strr[1]) {
    string a1 = strl[1] + strr[1];
    m1[a1]++;
  } else {
    string a1 = strr[1] + strl[1];
    m1[a1]++;
  }
  v[1] = a;
  sum = a;
  for (int i = 2; i <= n; i++) {
    cin >> strl[i] >> strr[i];
    if (strr[i - 1] == strl[i]) {
      v[i] = b;
    } else
      v[i] = a;
    sum += v[i];
    if (strl[i] > strr[i]) {
      string a1 = strl[i] + strr[i];
      m1[a1]++;
    } else {
      string a1 = strr[i] + strl[i];
      m1[a1]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (strl[i] > strr[i]) {
      string a1 = strl[i] + strr[i];
      m[a1] += v[i];
    } else {
      string a1 = strr[i] + strl[i];
      m[a1] += v[i];
    }
  }
  for (int i = 1; i <= n; i++) {
    if (strl[i] > strr[i]) {
      string a1 = strl[i] + strr[i];
      if (flag[a1] != 1) {
        if (f < m[a1]) {
          g[q] = m[a1] - f;
          flag[a1] = 1;
          q++;
        }
      }
    } else {
      string a1 = strr[i] + strl[i];
      if (flag[a1] != 1) {
        if (f < m[a1]) {
          g[q] = m[a1] - f;
          flag[a1] = 1;
          q++;
        }
      }
    }
  }
  sort(g, g + q);
  int x1 = min(q, k);
  for (int i = 1; i <= x1; i++) {
    sum -= g[q - i];
  }
  cout << sum;
  return 0;
}
