#include <bits/stdc++.h>
using namespace std;
int scan() {
  int i = 0;
  scanf("%d", &i);
  return i;
}
const int N = 4000 + 10;
const int MAX = 1E9 + 10;
int n, m, co[4], f[N][N], la[2][N][30];
char str[2][N];
int main() {
  int i, j, len[2];
  for (i = 0; i < 4; i++) co[i] = scan();
  scanf("%s", str[0] + 1);
  scanf("%s", str[1] + 1);
  len[0] = strlen(str[0] + 1);
  len[1] = strlen(str[1] + 1);
  for (i = 0; i <= len[0]; i++)
    for (j = 0; j <= len[1]; j++)
      if (i || j) f[i][j] = MAX;
  for (i = 1; i <= len[0]; i++) {
    for (j = 'a'; j <= 'z'; j++) la[0][i][j - 'a'] = la[0][i - 1][j - 'a'];
    if (i > 1) la[0][i][str[0][i - 1] - 'a'] = i - 1;
  }
  for (i = 1; i <= len[1]; i++) {
    for (j = 'a'; j <= 'z'; j++) la[1][i][j - 'a'] = la[1][i - 1][j - 'a'];
    if (i > 1) la[1][i][str[1][i - 1] - 'a'] = i - 1;
  }
  for (i = 0; i <= len[0]; i++)
    for (j = 0; j <= len[1]; j++)
      if (i || j) {
        if (i - 1 >= 0) f[i][j] = min(f[i][j], f[i - 1][j] + co[1]);
        if (j - 1 >= 0) f[i][j] = min(f[i][j], f[i][j - 1] + co[0]);
        if (i - 1 >= 0 && j - 1 >= 0) {
          if (str[0][i] == str[1][j])
            f[i][j] = min(f[i][j], f[i - 1][j - 1]);
          else
            f[i][j] = min(f[i][j], f[i - 1][j - 1] + co[2]);
        }
        int ii, jj;
        ii = la[0][i][str[1][j] - 'a'];
        jj = la[1][j][str[0][i] - 'a'];
        if (ii && jj)
          f[i][j] = min(f[i][j], f[ii - 1][jj - 1] + (i - ii - 1) * co[1] +
                                     (j - jj - 1) * co[0] + co[3]);
        if (i - 2 >= 0 && j - 2 >= 0) {
          if (str[0][i] == str[1][j - 1] && str[0][i - 1] != str[1][j])
            f[i][j] = min(f[i][j], f[i - 2][j - 2] + co[3] + co[2]);
          if (str[0][i] != str[1][j - 1] && str[0][i - 1] == str[1][j])
            f[i][j] = min(f[i][j], f[i - 2][j - 2] + co[3] + co[2]);
        }
      }
  printf("%d\n", f[len[0]][len[1]]);
  return 0;
}
