#include <bits/stdc++.h>
using namespace std;
enum { MAXN = 4010, MAXC = 26 };
int dp[MAXN][MAXN];
char sa[MAXN], sb[MAXN];
int pra[MAXN][MAXC], prb[MAXN][MAXC];
int main() {
  int ci, cd, cr, cs;
  scanf("%d%d%d%d", &ci, &cd, &cr, &cs);
  scanf("%s", sa + 1);
  scanf("%s", sb + 1);
  int la = strlen(sa + 1);
  fill(pra[0], pra[0] + MAXC, 0);
  for (int i = 1; i <= la; i++) {
    sa[i] -= 'a';
    copy(pra[i - 1], pra[i - 1] + MAXC, pra[i]);
    pra[i][sa[i]] = i;
  }
  int lb = strlen(sb + 1);
  fill(prb[0], prb[0] + MAXC, 0);
  for (int i = 1; i <= lb; i++) {
    sb[i] -= 'a';
    copy(prb[i - 1], prb[i - 1] + MAXC, prb[i]);
    prb[i][sb[i]] = i;
  }
  for (int i = 0; i <= la; i++) dp[i][0] = cd * i;
  for (int i = 0; i <= lb; i++) dp[0][i] = ci * i;
  for (int i = 1; i <= la; i++)
    for (int j = 1; j <= lb; j++) {
      dp[i][j] = min(min(dp[i - 1][j] + cd, dp[i][j - 1] + ci),
                     dp[i - 1][j - 1] + (sa[i] == sb[j] ? 0 : cr));
      if (sa[i] != sb[j] && pra[i][sb[j]] && prb[j][sa[i]]) {
        dp[i][j] = min(dp[i][j], dp[pra[i][sb[j]] - 1][prb[j][sa[i]] - 1] +
                                     (i - pra[i][sb[j]] - 1) * cd + cs +
                                     (j - prb[j][sa[i]] - 1) * ci);
      }
    }
  printf("%d\n", dp[la][lb]);
  return 0;
}
