#include <bits/stdc++.h>
using namespace std;
int dp[4010][4010];
int pa[4010][4010], pb[4010][4010];
char a[4010], b[4010];
int ti, td, tr, te;
int la, lb;
int main() {
  scanf("%d%d%d%d", &ti, &td, &tr, &te);
  scanf("%s%s", a + 1, b + 1);
  la = strlen(a + 1);
  lb = strlen(b + 1);
  for (int i = 1; i <= la; i++) {
    for (int j = 1; j <= lb; j++) {
      pa[i][j] = pa[i][j - 1];
      if (a[i] == b[j]) pa[i][j] = j;
    }
  }
  for (int i = 1; i <= lb; i++) {
    for (int j = 1; j <= la; j++) {
      pb[i][j] = pb[i][j - 1];
      if (a[j] == b[i]) pb[i][j] = j;
    }
  }
  for (int i = 0; i <= la; i++) {
    for (int j = 0; j <= lb; j++) {
      if (!i && !j) continue;
      dp[i][j] = 1e9;
      if (j) dp[i][j] = min(dp[i][j], dp[i][j - 1] + ti);
      if (i) dp[i][j] = min(dp[i][j], dp[i - 1][j] + td);
      if (i && j) {
        if (a[i] == b[j])
          dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]);
        else
          dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + tr);
        int li = pb[j][i - 1], lj = pa[i][j - 1];
        if (li && lj) {
          dp[i][j] = min(dp[i][j], dp[li - 1][lj - 1] + td * (i - li - 1) +
                                       ti * (j - lj - 1) + te);
        }
      }
    }
  }
  printf("%d", dp[la][lb]);
  return 0;
}
