#include <bits/stdc++.h>
using namespace std;
int t1, t2, t3, t4, pa[4005][150], pb[4005][150], dp[4005][4005];
char a[4005], b[4005];
int min(int x, int y) { return x > y ? y : x; }
int main() {
  while (cin >> t1 >> t2 >> t3 >> t4) {
    scanf("%s%s", a + 1, b + 1);
    int i, j;
    int la = strlen(a + 1);
    int lb = strlen(b + 1);
    memset(dp, 0, sizeof(dp));
    memset(pa, 0, sizeof(pa));
    memset(pb, 0, sizeof(pb));
    for (i = 1; i <= la; i++) {
      dp[i][0] = t2 * i;
      for (j = 'a'; j <= 'z'; j++) pa[i][j] = pa[i - 1][j];
      pa[i][a[i]] = i;
    }
    for (i = 1; i <= lb; i++) {
      dp[0][i] = t1 * i;
      for (j = 'a'; j <= 'z'; j++) pb[i][j] = pb[i - 1][j];
      pb[i][b[i]] = i;
    }
    for (i = 1; i <= la; i++)
      for (j = 1; j <= lb; j++) {
        dp[i][j] =
            min(dp[i][j - 1] + t1,
                min(dp[i - 1][j] + t2, dp[i - 1][j - 1] + t3 * (a[i] != b[j])));
        int ii = pa[i - 1][b[j]], jj = pb[j - 1][a[i]];
        if (ii && jj)
          dp[i][j] = min(dp[i][j], dp[ii - 1][jj - 1] + t4 + t2 * (i - ii - 1) +
                                       t1 * (j - jj - 1));
      }
    printf("%d\n", dp[la][lb]);
  }
  return 0;
}
