#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, k = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') k = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return x * k;
}
char A[4005], B[4005];
long long dp[4005][4005], f1[4005][30], f2[4005][30], t1, t2, t3, t4, n, m;
int main() {
  t1 = read(), t2 = read(), t3 = read(), t4 = read();
  scanf("%s%s", A + 1, B + 1);
  n = strlen(A + 1);
  m = strlen(B + 1);
  for (register int i = 2; i <= n; ++i) {
    memcpy(f1[i], f1[i - 1], sizeof(f1[i]));
    f1[i][A[i - 1] - 'a'] = i - 1;
  }
  for (register int i = 2; i <= m; i++) {
    memcpy(f2[i], f2[i - 1], sizeof(f2[i]));
    f2[i][B[i - 1] - 'a'] = i - 1;
  }
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0] = 0;
  for (register int i = 0; i <= n; ++i)
    for (register int j = 0; j <= m; ++j) {
      if (i) dp[i][j] = min(dp[i][j], dp[i - 1][j] + t2);
      if (j) dp[i][j] = min(dp[i][j], dp[i][j - 1] + t1);
      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] + t3);
        if (f1[i][B[j] - 'a'] && f2[j][A[i] - 'a']) {
          long long a = f1[i][B[j] - 'a'], b = f2[j][A[i] - 'a'];
          dp[i][j] = min(dp[i][j], dp[a - 1][b - 1] + t4 + t2 * (i - a - 1) +
                                       t1 * (j - b - 1));
        }
      }
    }
  printf("%lld", dp[n][m]);
}
