#include <bits/stdc++.h>
using namespace std;
int f[4010][4010];
int pos[30];
int lasta[4010][30], lastb[4010][30];
string a, b;
int Ti, Td, Tr, Te, N, M;
int main() {
  scanf("%d%d%d%d\n", &Ti, &Td, &Tr, &Te);
  getline(cin, a);
  N = a.length();
  getline(cin, b);
  M = b.length();
  a = '0' + a;
  b = '0' + b;
  for (int i = 1; i <= N; ++i) {
    pos[int(a[i]) - 96] = i;
    for (int j = 1; j <= 26; ++j) lasta[i][j] = pos[j];
  }
  memset(pos, 0, sizeof(pos));
  for (int i = 1; i <= M; ++i) {
    pos[int(b[i]) - 96] = i;
    for (int j = 1; j <= 26; ++j) lastb[i][j] = pos[j];
  }
  memset(f, 127, sizeof(f));
  f[0][0] = 0;
  for (int i = 1; i <= N; ++i) f[i][0] = Td * i;
  for (int j = 1; j <= M; ++j) f[0][j] = Ti * j;
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= M; ++j) {
      if (a[i] == b[j]) f[i][j] = f[i - 1][j - 1];
      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 ii = lasta[i - 1][int(b[j]) - 96], jj = lastb[j - 1][int(a[i]) - 96];
      if (ii >= 1 && jj >= 1)
        f[i][j] = min(f[i][j], f[ii - 1][jj - 1] + (i - ii - 1) * Td +
                                   (j - jj - 1) * Ti + Te);
    }
  }
  cout << f[N][M];
  return 0;
}
