#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4000 + 10;
const int INF = 0x3f3f3f3f;
int ti, td, tr, te;
int f[MAXN][MAXN], da[MAXN][27], db[MAXN][27];
char sa[MAXN], sb[MAXN];
bool Input(void) {
  if (EOF == scanf("%d %d %d %d", &ti, &td, &tr, &te)) {
    return false;
  }
  scanf("%s %s", sa, sb);
  return true;
}
int Process(void) {
  int lena = strlen(sa);
  int lenb = strlen(sb);
  f[0][0] = 0;
  memset(da, -1, sizeof(da));
  memset(db, -1, sizeof(db));
  for (int i = 1; i <= lena; i++) {
    for (int ch = 'a'; ch <= 'z'; ch++) {
      da[i][ch] = da[i - 1][ch];
    }
    da[i][sa[i - 1]] = i;
    f[i][0] = i * td;
  }
  for (int i = 1; i <= lenb; i++) {
    for (int ch = 'a'; ch <= 'z'; ch++) {
      db[i][ch] = db[i - 1][ch];
    }
    db[i][sb[i - 1]] = i;
    f[0][i] = i * ti;
  }
  for (int i = 1; i <= lena; i++) {
    for (int j = 1; j <= lenb; j++) {
      f[i][j] = INF;
      if (sa[i - 1] == sb[j - 1]) {
        f[i][j] = f[i - 1][j - 1];
        continue;
      }
      f[i][j] = min(f[i][j], f[i][j - 1] + ti);
      f[i][j] = min(f[i][j], f[i - 1][j] + td);
      f[i][j] = min(f[i][j], f[i - 1][j - 1] + tr);
      int pre_a = da[i][sb[j - 1]];
      int pre_b = db[j][sa[i - 1]];
      if (-1 != pre_a && -1 != pre_b) {
        f[i][j] = min(f[i][j], f[pre_a - 1][pre_b - 1] + (i - pre_a - 1) * td +
                                   te + (j - pre_b - 1) * ti);
      }
    }
  }
  return f[lena][lenb];
}
int main(int argc, char const *argv[]) {
  while (true == Input()) {
    printf("%d\n", Process());
  }
  return 0;
}
