#include <bits/stdc++.h>
char s1[4010], s2[4010];
int ti, td, tr, te;
int n, m;
int dp[4010][4010], pa1[4010][26], pa2[4010][26];
const int inf = 0x0f0f0f0f;
inline void minto(int &a, int b) {
  if (b < a) a = b;
}
int main() {
  scanf("%d%d%d%d", &ti, &td, &tr, &te);
  scanf("%s%s", s1 + 1, s2 + 1);
  n = strlen(s1 + 1);
  m = strlen(s2 + 1);
  memset(dp, 0x0f, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    s1[i] -= 'a';
    memcpy(pa1[i], pa1[i - 1], sizeof(int) * 26);
    pa1[i][s1[i]] = i;
    dp[i][0] = td * i;
  }
  for (int i = 1; i <= m; i++) {
    s2[i] -= 'a';
    memcpy(pa2[i], pa2[i - 1], sizeof(int) * 26);
    pa2[i][s2[i]] = i;
    dp[0][i] = ti * i;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      dp[i][j] = dp[i - 1][j - 1] + (s1[i] != s2[j]) * tr;
      minto(dp[i][j], dp[i][j - 1] + ti);
      minto(dp[i][j], dp[i - 1][j] + td);
      if (s1[i] != s2[j]) {
        int a = pa1[i - 1][s2[j]], b = pa2[j - 1][s1[i]];
        if (a && b)
          minto(dp[i][j],
                dp[a - 1][b - 1] + td * (i - a - 1) + te + ti * (j - b - 1));
      }
    }
  printf("%d\n", dp[n][m]);
  return 0;
}
