#include <bits/stdc++.h>
using namespace std;
int t1, t2, t3, t4, n, m, f[4010][4010];
char s1[10100], s2[10100];
void update(int &a, int b) {
  if (a == -1 || a > b) a = b;
}
int las[30], next1[10100][30], next2[10100][30];
int main() {
  scanf("%d%d%d%d", &t1, &t2, &t3, &t4);
  scanf(" %s %s", s1, s2);
  n = strlen(s1), m = strlen(s2);
  memset(las, -1, sizeof las);
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) next1[i][j] = las[j];
    las[s1[i] - 'a'] = i;
  }
  memset(las, -1, sizeof las);
  for (int i = m - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) next2[i][j] = las[j];
    las[s2[i] - 'a'] = i;
  }
  s1[n] = s2[m] = '$';
  memset(f, -1, sizeof(f));
  f[0][0] = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      if (i < n) update(f[i + 1][j], f[i][j] + t2);
      if (j < m) update(f[i][j + 1], f[i][j] + t1);
      if (i < n && j < m) {
        update(f[i + 1][j + 1], f[i][j] + (s1[i] == s2[j] ? 0 : t3));
        if (next1[i][s2[j] - 'a'] != -1 && next2[j][s1[i] - 'a'] != -1 &&
            s1[i] != s2[j])
          update(f[next1[i][s2[j] - 'a'] + 1][next2[j][s1[i] - 'a'] + 1],
                 f[i][j] + t4 + t2 * (next1[i][s2[j] - 'a'] - i - 1) +
                     t1 * (next2[j][s1[i] - 'a'] - j - 1));
      }
    }
  printf("%d\n", f[n][m]);
}
