#include <bits/stdc++.h>
using namespace std;
int ti, td, tr, te, i, j, n, m;
char a, b;
char x[4001], y[4001];
int M[4001][4001], P[27][4001], P2[27][4001];
int main() {
  scanf("%d%d%d%d%s%s", &ti, &td, &tr, &te, y, x);
  n = strlen(x);
  m = strlen(y);
  for (i = 0; i <= n; i++) M[i][0] = ti * i;
  for (i = 0; i <= m; i++) M[0][i] = td * i;
  for (i = 0; i < 26; i++) {
    P[i][0] = P2[i][0] = -1;
    if (i == x[0] - 'a') P[i][0] = 0;
    if (i == y[0] - 'a') P2[i][0] = 0;
  }
  for (i = 1; i < n; i++)
    for (j = 0; j < 26; j++) {
      P[j][i] = P[j][i - 1];
      if (j == x[i] - 'a') P[j][i] = i;
    }
  for (i = 1; i < m; i++)
    for (j = 0; j < 26; j++) {
      P2[j][i] = P2[j][i - 1];
      if (j == y[i] - 'a') P2[j][i] = i;
    }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      a = x[i - 1];
      b = y[j - 1];
      M[i][j] = M[i - 1][j] + ti;
      M[i][j] = min(M[i][j], M[i][j - 1] + td);
      M[i][j] = min(M[i][j], M[i - 1][j - 1] + tr * (a != b));
      if (min(i, j) >= 2 && P2[a - 'a'][j - 2] != -1 && P[b - 'a'][i - 2] != -1)
        M[i][j] = min(M[i][j], M[P[b - 'a'][i - 2]][P2[a - 'a'][j - 2]] +
                                   (i - P[b - 'a'][i - 2] - 2) * ti +
                                   (j - P2[a - 'a'][j - 2] - 2) * td + te);
    }
  printf("%d\n", M[n][m]);
  return 0;
}
