#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4040;
char A[MAXN], B[MAXN];
int lstA[MAXN][128], lstB[MAXN][128];
int dp[MAXN][MAXN];
int main() {
  int TI, TD, TR, TE;
  scanf("%d%d%d%d", &TI, &TD, &TR, &TE);
  scanf("%s%s", A + 1, B + 1);
  int lenA = strlen(A + 1), lenB = strlen(B + 1);
  for (int i = 1; i <= lenA; i++) {
    memcpy(lstA[i], lstA[i - 1], sizeof lstA[0]);
    lstA[i][(int)A[i]] = i;
  }
  for (int i = 1; i <= lenB; i++) {
    memcpy(lstB[i], lstB[i - 1], sizeof lstB[0]);
    lstB[i][(int)B[i]] = i;
  }
  memset(dp, 0x3f, sizeof dp);
  dp[0][0] = 0;
  for (int i = 0; i <= lenA; i++)
    for (int j = 0; j <= lenB; j++) {
      if (A[i] == B[j]) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]);
      if (i) dp[i][j] = min(dp[i][j], dp[i - 1][j] + TD);
      if (j) dp[i][j] = min(dp[i][j], dp[i][j - 1] + TI);
      if (i && j) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + TR);
      if (i && j) {
        int posB = lstB[j - 1][(int)A[i]], posA = lstA[i - 1][(int)B[j]];
        if (posB && posA) {
          dp[i][j] =
              min(dp[i][j], dp[posA - 1][posB - 1] + (i - 1 - posA) * TD +
                                (j - 1 - posB) * TI + TE);
        }
      }
    }
  printf("%d\n", dp[lenA][lenB]);
}
