#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int ti, td, tr, te, n, p[N], f[N][N], la[N][30], lb[N][30], m;
char s1[N], s2[N];
inline void fr(long long &num) {
  num = 0;
  char c = getchar();
  int p = 1;
  while (c < '0' || c > '9') c == '-' ? p = -1, c = getchar() : c = getchar();
  while (c >= '0' && c <= '9') num = num * 10 + c - '0', c = getchar();
  num *= p;
}
int main() {
  scanf("%d%d%d%d%s%s", &ti, &td, &tr, &te, s1 + 1, s2 + 1);
  n = strlen(s1 + 1), m = strlen(s2 + 1);
  for (register int i = 1; i <= n; ++i) {
    for (register int j = 0; j < 26; ++j) la[i][j] = p[j];
    p[s1[i] - 'a'] = i;
  }
  for (register int i = 0; i < 26; ++i) p[i] = 0;
  for (register int i = 1; i <= m; ++i) {
    for (register int j = 0; j < 26; ++j) lb[i][j] = p[j];
    p[s2[i] - 'a'] = i;
  }
  memset(f, 127, sizeof(f));
  f[0][0] = 0;
  for (register int i = 0, u, v; i <= n; ++i)
    for (register int j = 0; j <= m; ++j) {
      if (i)
        f[i][j] = (f[i][j] < f[i - 1][j] + td ? f[i][j] : f[i - 1][j] + td);
      if (j)
        f[i][j] = (f[i][j] < f[i][j - 1] + ti ? f[i][j] : f[i][j - 1] + ti);
      if (i && j)
        f[i][j] = (f[i][j] < f[i - 1][j - 1] + (s1[i] == s2[j] ? 0 : tr)
                       ? f[i][j]
                       : f[i - 1][j - 1] + (s1[i] == s2[j] ? 0 : tr));
      u = la[i][s2[j] - 'a'], v = lb[j][s1[i] - 'a'];
      if (u && v)
        f[i][j] =
            (f[i][j] <
                     f[u - 1][v - 1] + (j - v - 1) * ti + (i - u - 1) * td + te
                 ? f[i][j]
                 : f[u - 1][v - 1] + (j - v - 1) * ti + (i - u - 1) * td + te);
    }
  printf("%d", f[n][m]);
  return 0;
}
