#include <bits/stdc++.h>
using namespace std;
const int maxn = 4440;
char a[maxn], b[maxn];
int f[maxn][maxn];
int finda[maxn][256], findb[maxn][256];
int t1, t2, t3, t4;
void init() {
  scanf("%d%d%d%d", &t1, &t2, &t3, &t4);
  scanf("%s", a + 1), scanf("%s", b + 1);
}
int lena, lenb;
void work() {
  lena = strlen(a + 1);
  lenb = strlen(b + 1);
  for (int i = 1; i <= lena; i++) {
    f[i][0] = t2 * i;
    for (int j = 'a'; j <= 'z'; j++) finda[i][j] = finda[i - 1][j];
    finda[i][a[i]] = i;
  }
  for (int i = 1; i <= lenb; i++) {
    f[0][i] = t1 * i;
    for (int j = 'a'; j <= 'z'; j++) findb[i][j] = findb[i - 1][j];
    findb[i][b[i]] = i;
  }
  for (int i = 1; i <= lena; i++)
    for (int j = 1; j <= lenb; j++) {
      f[i][j] = min(f[i - 1][j] + t2, f[i][j - 1] + t1);
      f[i][j] = min(f[i][j], f[i - 1][j - 1] + t3);
      if (a[i] == b[j]) f[i][j] = min(f[i][j], f[i - 1][j - 1]);
      int pa = finda[i - 1][b[j]];
      int pb = findb[j - 1][a[i]];
      if (pa && pb)
        f[i][j] = min(f[i][j], f[pa - 1][pb - 1] + t4 + (i - pa - 1) * t2 +
                                   (j - pb - 1) * t1);
    }
  printf("%d\n", f[lena][lenb]);
}
int main() {
  init();
  work();
  return 0;
}
