#include <bits/stdc++.h>
using namespace std;
int a, b, c, d;
int n, m, dp[4005][4005], pre[2][26][4005], tmp[26];
char A[4005], B[4005];
int main() {
  scanf("%d%d%d%d", &a, &b, &c, &d);
  scanf("%s%s", A + 1, B + 1);
  n = strlen(A + 1);
  m = strlen(B + 1);
  memset(dp, 0x3f, sizeof dp);
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) dp[i][0] = b * i;
  for (int i = 1; i <= m; i++) dp[0][i] = a * i;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 26; j++) pre[0][j][i] = tmp[j];
    tmp[A[i] - 'a'] = i;
  }
  memset(tmp, 0, sizeof tmp);
  for (int i = 1; i <= m; i++) {
    for (int j = 0; j < 26; j++) pre[1][j][i] = tmp[j];
    tmp[B[i] - 'a'] = i;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (A[i] == B[j]) dp[i][j] = dp[i - 1][j - 1];
      dp[i][j] = min(
          dp[i][j],
          min(dp[i - 1][j] + b, min(dp[i][j - 1] + a, dp[i - 1][j - 1] + c)));
      if (pre[0][B[j] - 'a'][i] && pre[1][A[i] - 'a'][j])
        dp[i][j] = min(
            dp[i][j], dp[pre[0][B[j] - 'a'][i] - 1][pre[1][A[i] - 'a'][j] - 1] +
                          d + (i - pre[0][B[j] - 'a'][i] - 1) * b +
                          (j - pre[1][A[i] - 'a'][j] - 1) * a);
    }
  printf("%d\n", dp[n][m]);
}
