#include <bits/stdc++.h>
using namespace std;
int dp[4005][4005], p1[4005][30], p2[4005][30], a, b, c, d, len1, len2;
char ch1[4005], ch2[4005];
int main() {
  scanf("%d%d%d%d%*c", &a, &b, &c, &d);
  scanf("%s%*c%s%*c", ch1 + 1, ch2 + 1);
  len1 = strlen(ch1 + 1);
  len2 = strlen(ch2 + 1);
  memset(p1, 0, sizeof(p1));
  memset(p2, 0, sizeof(p2));
  for (int i = len1; i >= 1; i--) {
    memcpy(p1[i], p1[i + 1], sizeof(p1[i]));
    p1[i][ch1[i] - 'a'] = i;
  }
  for (int i = len2; i >= 1; i--) {
    memcpy(p2[i], p2[i + 1], sizeof(p2[i]));
    p2[i][ch2[i] - 'a'] = i;
  }
  for (int i = 0; i <= len1; i++)
    for (int j = 0; j <= len2; j++) dp[i][j] = (1e8 + 7);
  dp[0][0] = 0;
  for (int i = 0; i <= len1; i++) {
    for (int j = 0; j <= len2; j++) {
      if (ch1[i + 1] == ch2[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] + b);
      dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + a);
      dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + c);
      int l = p1[i + 2][ch2[j + 1] - 'a'], r = p2[j + 2][ch1[i + 1] - 'a'];
      if (l && r)
        dp[l][r] =
            min(dp[l][r], dp[i][j] + (l - i - 2) * b + (r - j - 2) * a + d);
    }
  }
  printf("%d\n", dp[len1][len2]);
  return 0;
}
