#include <bits/stdc++.h>
const int N = 4005;
const int INF = 1000000005;
int dp[N][N], p1[26], p2[26];
char s1[N], s2[N];
int a1[N], a2[N];
int main() {
  int i, j, t1, t2, t3, t4, n, m, t, tt;
  scanf("%d%d%d%d", &t1, &t2, &t3, &t4);
  scanf("%s%s", s2, s1);
  m = strlen(s1);
  n = strlen(s2);
  for (i = 0; i <= m; i++)
    for (j = 0; j <= n; j++) dp[i][j] = INF;
  for (i = 0; i <= m; i++) dp[i][0] = i * t1;
  for (j = 1; j <= n; j++) dp[0][j] = j * t2;
  for (i = 1; i <= m; i++) a1[i] = s1[i - 1] - 'a';
  for (i = 1; i <= n; i++) a2[i] = s2[i - 1] - 'a';
  for (i = 1; i <= m; i++) {
    memset(p2, 0, sizeof(p2));
    for (j = 1; j <= n; j++) {
      t = INF;
      tt = dp[i - 1][j - 1] + (a1[i] != a2[j]) * t3;
      if (t > tt) t = tt;
      tt = dp[i][j - 1] + t2;
      if (t > tt) t = tt;
      tt = dp[i - 1][j] + t1;
      if (t > tt) t = tt;
      if (p1[a2[j]] && p2[a1[i]]) {
        tt = dp[p1[a2[j]] - 1][p2[a1[i]] - 1] + t4 + (i - p1[a2[j]] - 1) * t1 +
             (j - p2[a1[i]] - 1) * t2;
        if (t > tt) t = tt;
      }
      dp[i][j] = t;
      p2[a2[j]] = j;
    }
    p1[a1[i]] = i;
  }
  printf("%d\n", dp[m][n]);
  return 0;
}
