#include <bits/stdc++.h>
const int maxn = 4005;
const int inf = 0x7fffffff;
int dp[maxn][maxn], la[2][26], n, m, ti, td, tr, te;
char s1[maxn], s2[maxn];
int getmin(int a, int b) { return a < b ? a : b; }
void init() {
  scanf("%d%d%d%d%s%s", &ti, &td, &tr, &te, s1, s2);
  n = strlen(s1);
  m = strlen(s2);
}
void work() {
  memset(la[0], 0, sizeof(la[0]));
  for (int i = 1; i <= m; i++) dp[0][i] = i * ti;
  for (int i = 1; i <= n; i++) dp[i][0] = i * td;
  for (int i = 1; i <= n; i++) {
    memset(la[1], 0, sizeof(la[1]));
    for (int j = 1; j <= m; j++) {
      dp[i][j] = getmin(dp[i][j - 1] + ti, dp[i - 1][j] + td);
      dp[i][j] =
          getmin(dp[i][j], dp[i - 1][j - 1] + tr * (s1[i - 1] != s2[j - 1]));
      int t1 = la[0][s2[j - 1] - 'a'] - 1, t2 = la[1][s1[i - 1] - 'a'] - 1;
      if (t1 != -1 && t2 != -1)
        dp[i][j] = getmin(
            dp[i][j], dp[t1][t2] + (i - t1 - 2) * td + (j - t2 - 2) * ti + te);
      la[1][s2[j - 1] - 'a'] = j;
    }
    la[0][s1[i - 1] - 'a'] = i;
  }
  printf("%d\n", dp[n][m]);
}
int main() {
  init();
  work();
  return 0;
}
