#include <bits/stdc++.h>
using namespace std;
int f[5000][5000];
char a[5000], b[5000];
int ti, td, tr, te;
int lasta[5000][26], lastb[5000][26];
int main() {
  scanf("%d%d%d%d", &ti, &td, &tr, &te);
  getchar();
  gets(a), gets(b);
  int la, lb;
  la = strlen(a), lb = strlen(b);
  tr = min(tr, ti + td);
  for (int i = 0; i < 5000; ++i)
    for (int j = 0; j < 5000; ++j) f[i][j] = 214748364;
  for (int i = 0; i <= lb; ++i) {
    f[0][i] = i * ti;
    if (i) memcpy(lastb[i], lastb[i - 1], sizeof lastb[i]);
    if (i) lastb[i][b[i - 1] - 'a'] = i;
  }
  for (int i = 0; i <= la; ++i) {
    f[i][0] = i * td;
    if (i) memcpy(lasta[i], lasta[i - 1], sizeof lasta[i]);
    if (i) lasta[i][a[i - 1] - 'a'] = i;
  }
  for (int i = 1; i <= la; ++i) {
    for (int j = 1; j <= lb; ++j) {
      f[i][j] = f[i - 1][j] + td;
      f[i][j] =
          min(f[i][j], f[i - 1][j - 1] + ((a[i - 1] == b[j - 1]) ? 0 : tr));
      f[i][j] = min(f[i][j], f[i][j - 1] + ti);
      int x = lasta[i - 1][b[j - 1] - 'a'], y = lastb[j - 1][a[i - 1] - 'a'];
      if (x && y) {
        f[i][j] = min(f[i][j], f[x - 1][y - 1] + te + (i - x - 1) * td +
                                   (j - y - 1) * ti);
      }
    }
  }
  printf("%d\n", f[la][lb]);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
