#include <bits/stdc++.h>
using namespace std;
int dp[4005][4005], t1, t2, t3, t4;
int p1[4005][30], p2[4005][30];
char s[4005], t[4005];
int n, m;
void input() {
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
  memset(p1[0], -1, sizeof p1[0]);
  memset(p2[0], -1, sizeof p2[0]);
}
int main() {
  int i, j, x, y;
  while (~scanf("%d %d %d %d", &t1, &t2, &t3, &t4)) {
    input();
    for (i = 0; i <= n; i++)
      for (j = 0; j <= m; j++) dp[i][j] = 10000000;
    dp[0][0] = 0;
    for (i = n; i; i--) {
      memcpy(p1[i], p1[i + 1], sizeof p1[i]);
      p1[i][s[i] - 'a'] = i;
    }
    for (i = m; i; i--) {
      memcpy(p2[i], p2[i + 1], sizeof p2[i]);
      p2[i][t[i] - 'a'] = i;
    }
    for (i = 0; i <= n; i++)
      for (j = 0; j <= m; j++) {
        if (s[i + 1] == t[j + 1]) {
          dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j]);
        };
        { dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + t2); };
        { dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + t1); };
        { dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + t3); };
        if ((x = p1[i + 2][t[j + 1] - 'a']) &&
            (y = p2[j + 2][s[i + 1] - 'a'])) {
          {
            dp[x][y] = min(dp[x][y],
                           dp[i][j] + (x - i - 2) * t2 + (y - j - 2) * t1 + t4);
          };
        }
      }
    cout << dp[n][m] << endl;
  }
  return 0;
}
