#include <bits/stdc++.h>
using namespace std;
const int t = 4005;
int f[t][t], a[33], b[33];
char s1[4005], s2[4005];
void cmin(int &a, int b) {
  if (b < a) a = b;
}
int min(int a, int b, int c) { return min(a, min(b, c)); }
int main() {
  int i, j, ti, td, tr, te, len1, len2;
  scanf("%d%d%d%d", &ti, &td, &tr, &te);
  scanf("%s%s", s1 + 1, s2 + 1);
  len1 = strlen(s1 + 1), len2 = strlen(s2 + 1);
  memset(f, 61, sizeof f);
  for (f[0][0] = 0, i = 1; i <= len1; i++) f[i][0] = i * td, s1[i] -= 'a';
  for (i = 1; i <= len2; i++) f[0][i] = i * ti, s2[i] -= 'a';
  memset(a, 0, sizeof a);
  for (i = 1; i <= len1; i++) {
    memset(b, 0, sizeof b);
    for (j = 1; j <= len2; j++) {
      cmin(f[i][j], min(f[i][j - 1] + ti, f[i - 1][j] + td,
                        f[i - 1][j - 1] + tr * (s1[i] != s2[j])));
      if (b[s1[i]] && a[s2[j]])
        cmin(f[i][j], f[a[s2[j]] - 1][b[s1[i]] - 1] + td * (i - a[s2[j]] - 1) +
                          ti * (j - b[s1[i]] - 1) + te);
      b[s2[j]] = j;
    }
    a[s1[i]] = i;
  }
  printf("%d\n", f[len1][len2]);
  return 0;
}
