#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
int n, m, val[5], dp[5005][5005], pos[27], ca[5005][27], cb[5005][27];
char a[5005], b[5005];
signed main() {
  for (int i = 1; i <= 4; ++i) scanf("%d", &val[i]);
  scanf("%s%s", a + 1, b + 1), n = strlen(a + 1), m = strlen(b + 1),
                               memset(pos, 0, sizeof(pos));
  for (register int i = 1; i <= n; ++i) {
    for (register int j = 0; j < 26; ++j) ca[i][j] = pos[j];
    pos[a[i] - 'a'] = i;
  }
  memset(pos, 0, sizeof(pos));
  for (int i = 1; i <= m; ++i) {
    for (int j = 0; j < 26; ++j) cb[i][j] = pos[j];
    pos[b[i] - 'a'] = i;
  }
  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 (j) dp[i][j] = min(dp[i][j], dp[i][j - 1] + val[1]);
      if (i) dp[i][j] = min(dp[i][j], dp[i - 1][j] + val[2]);
      if (i && j)
        dp[i][j] =
            min(dp[i][j], dp[i - 1][j - 1] + (a[i] == b[j] ? 0 : val[3]));
      int pa = ca[i][b[j] - 'a'], pb = cb[j][a[i] - 'a'];
      if (pa && pb) {
        int temp = (j - pb - 1) * val[1] + (i - pa - 1) * val[2] + val[4];
        dp[i][j] = min(dp[i][j], dp[pa - 1][pb - 1] + temp);
      }
    }
  return printf("%d\n", dp[n][m]), 0;
}
