#include <bits/stdc++.h>
using namespace std;
int R[4 << 10][4 << 10];
int Next1[32][4 << 10];
int Next2[32][4 << 10];
char buf1[4 << 10];
char buf2[4 << 10];
int main() {
  int ti, td, tr, te;
  scanf("%d%d%d%d", &ti, &td, &tr, &te);
  scanf("%s%s", buf1, buf2);
  int len1 = strlen(buf1);
  int len2 = strlen(buf2);
  int i, j;
  for (i = (0); i < (26); ++i) {
    Next1[i][len1] = len1;
    for (j = (len1)-1; j >= (0); --j)
      Next1[i][j] = buf1[j] == i + 'a' ? j : Next1[i][j + 1];
    Next2[i][len2] = len2;
    for (j = (len2)-1; j >= (0); --j)
      Next2[i][j] = buf2[j] == i + 'a' ? j : Next2[i][j + 1];
  }
  for (i = (0); i < (len1 + 1); ++i)
    for (j = (0); j < (len2 + 1); ++j) R[i][j] = (1 << 30);
  R[0][0] = 0;
  for (i = (0); i < (len1 + 1); ++i)
    for (j = (0); j < (len2 + 1); ++j) {
      if (i != len1) R[i + 1][j] = min(R[i + 1][j], R[i][j] + td);
      if (j != len2) R[i][j + 1] = min(R[i][j + 1], R[i][j] + ti);
      if (i != len1 && j != len2)
        R[i + 1][j + 1] =
            min(R[i + 1][j + 1], R[i][j] + (buf1[i] == buf2[j] ? 0 : tr));
      if (i + 1 < len1 && j + 1 < len2) {
        int n1 = Next1[buf2[j] - 'a'][i + 1];
        int n2 = Next2[buf1[i] - 'a'][j + 1];
        if (n1 != len1)
          R[n1 + 1][j + 2] =
              min(R[n1 + 1][j + 2], R[i][j] + te + tr + (n1 - i - 1) * td);
        if (n2 != len2)
          R[i + 2][n2 + 1] =
              min(R[i + 2][n2 + 1], R[i][j] + te + tr + (n2 - j - 1) * ti);
        if (n1 != len1 && n2 != len2)
          R[n1 + 1][n2 + 1] =
              min(R[n1 + 1][n2 + 1],
                  R[i][j] + te + (n1 - i - 1) * td + (n2 - j - 1) * ti);
      }
    }
  printf("%d\n", R[len1][len2]);
  return 0;
};
