#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int maxn = 4e3 + 10, INF = 0x3f3f3f3f;
int N, M, T[4];
char A[maxn], B[maxn];
int nearA[26][maxn], nearB[26][maxn];
int dp[maxn][maxn];
int main() {
  for (int i = 0; i < 4; i++) scanf("%d", &T[i]);
  scanf(" %s %s", A + 1, B + 1);
  N = strlen(A + 1);
  M = strlen(B + 1);
  memset(nearA, -1, sizeof(nearA));
  memset(nearB, -1, sizeof(nearB));
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j < 26; j++) nearA[j][i] = nearA[j][i - 1];
    nearA[A[i] - 'a'][i] = i;
  }
  for (int i = 1; i <= M; i++) {
    for (int j = 0; j < 26; j++) nearB[j][i] = nearB[j][i - 1];
    nearB[B[i] - 'a'][i] = i;
  }
  dp[0][0] = 0;
  for (int i = 1; i <= N; i++) dp[i][0] = i * T[1];
  for (int i = 1; i <= M; i++) dp[0][i] = i * T[0];
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      dp[i][j] = min(dp[i][j - 1] + T[0], dp[i - 1][j] + T[1]);
      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] + T[2]);
      int na = nearA[B[j] - 'a'][i - 1], nb = nearB[A[i] - 'a'][j - 1];
      if (~na && ~nb) {
        dp[i][j] = min(dp[i][j], (i - na - 1) * T[1] + (j - nb - 1) * T[0] +
                                     T[3] + dp[na - 1][nb - 1]);
      }
    }
  }
  printf("%d\n", dp[N][M]);
  return 0;
}
