#include <bits/stdc++.h>
using namespace std;
const int MAXL = 4001;
int f[MAXL][MAXL], f1[MAXL][26], f2[MAXL][26], l1, l2, ti, td, tr, te, i, j, k,
    l;
char a[MAXL], b[MAXL];
int main() {
  scanf("%d%d%d%d", &ti, &td, &tr, &te);
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  l1 = strlen(a + 1), l2 = strlen(b + 1);
  for (i = 1; i <= l1; i++) {
    f[i][0] = i * td;
    for (j = 'a'; j <= 'z'; j++) f1[i][j - 'a'] = f1[i - 1][j - 'a'];
    f1[i][a[i] - 'a'] = i;
  }
  for (i = 1; i <= l2; i++) {
    f[0][i] = i * ti;
    for (j = 'a'; j <= 'z'; j++) f2[i][j - 'a'] = f2[i - 1][j - 'a'];
    f2[i][b[i] - 'a'] = i;
  }
  for (i = 1; i <= l1; i++)
    for (j = 1; j <= l2; j++) {
      f[i][j] = min(f[i][j - 1] + ti, f[i - 1][j] + td);
      f[i][j] = min(f[i][j], f[i - 1][j - 1] + tr * (a[i] != b[j]));
      if ((k = f1[i - 1][b[j] - 'a']) && (l = f2[j - 1][a[i] - 'a']))
        f[i][j] = min(f[i][j], f[k - 1][l - 1] + te + td * (i - k - 1) +
                                   ti * (j - l - 1));
    }
  printf("%d\n", f[l1][l2]);
  return 0;
}
