#include <bits/stdc++.h>
using namespace std;
const int MaxN = 4005, LET = 26, MaxC = 0x3F3F3F3F, NA = -1;
int f[MaxN][MaxN];
int p[LET][MaxN], q[LET][MaxN];
char s[MaxN], t[MaxN];
int m, n;
int main(void) {
  int i, j, k, cp, cq, ti, td, tr, te;
  while (scanf(" %d %d %d %d", &ti, &td, &tr, &te) != EOF) {
    assert(ti + td <= te + te);
    scanf(" %s %s", s, t);
    m = strlen(s);
    n = strlen(t);
    for (j = 'a'; j <= 'z'; j++) {
      k = NA;
      for (i = 0; i < m; i++) {
        if (s[i] == j) k = i;
        p[j - 'a'][i] = k;
      }
    }
    for (j = 'a'; j <= 'z'; j++) {
      k = NA;
      for (i = 0; i < n; i++) {
        if (t[i] == j) k = i;
        q[j - 'a'][i] = k;
      }
    }
    for (i = 0; i <= m; i++)
      for (j = 0; j <= n; j++)
        if (i == 0)
          f[i][j] = j * ti;
        else if (j == 0)
          f[i][j] = i * td;
        else {
          f[i][j] = min(f[i - 1][j - 1] + tr * (s[i - 1] != t[j - 1]),
                        min(f[i - 1][j] + td, f[i][j - 1] + ti));
          if (i >= 2 && j >= 2 && (cp = p[t[j - 1] - 'a'][i - 2]) != NA &&
              (cq = q[s[i - 1] - 'a'][j - 2]) != NA)
            f[i][j] = min(f[i][j], f[cp][cq] + te + td * (i - 2 - cp) +
                                       ti * (j - 2 - cq));
        }
    printf("%d\n", f[m][n]);
  }
  return 0;
}
