#include <bits/stdc++.h>
using namespace std;
int ni() {
  int a;
  scanf("%d", &a);
  return a;
}
double nf() {
  double a;
  scanf("%lf", &a);
  return a;
}
char sbuf[100005];
string ns() {
  scanf("%s", sbuf);
  return sbuf;
}
long long nll() {
  long long a;
  scanf("%lld", &a);
  return a;
}
template <class T>
void out(T a, T b) {
  bool first = true;
  for (T i = a; i != b; ++i) {
    if (!first) printf(" ");
    first = false;
    cout << *i;
  }
  printf("\n");
}
template <class T>
void outl(T a, T b) {
  for (T i = a; i != b; ++i) {
    cout << *i << "\n";
  }
}
int n, m;
int d[4005][4005];
int lst1[4005][30];
int lst2[4005][30];
int main() {
  int i, j, k;
  int ti = ni();
  int td = ni();
  int tr = ni();
  int te = ni();
  string s1 = ns();
  string s2 = ns();
  n = s1.size();
  m = s2.size();
  memset(lst1, -1, sizeof(lst1));
  memset(lst2, -1, sizeof(lst2));
  for (i = (0); i < (((n))); ++i)
    if (i) {
      for (j = (0); j < (((26))); ++j) lst1[i][j] = lst1[i - 1][j];
      lst1[i][s1[i - 1] - 'a'] = i - 1;
    }
  for (i = (0); i < (((m))); ++i)
    if (i) {
      for (j = (0); j < (((26))); ++j) lst2[i][j] = lst2[i - 1][j];
      lst2[i][s2[i - 1] - 'a'] = i - 1;
    }
  memset(d, 63, sizeof(d));
  d[0][0] = 0;
  for (i = (0); i < (((n + 1))); ++i)
    for (j = (0); j < (((m + 1))); ++j) {
      if (i < n) d[i + 1][j] = min(d[i + 1][j], d[i][j] + td);
      if (j < m) d[i][j + 1] = min(d[i][j + 1], d[i][j] + ti);
      if (i < n && j < m) {
        if (s1[i] == s2[j])
          d[i + 1][j + 1] = min(d[i + 1][j + 1], d[i][j]);
        else
          d[i + 1][j + 1] = min(d[i + 1][j + 1], d[i][j] + tr);
        int l1 = lst1[i][s2[j] - 'a'];
        int l2 = lst2[j][s1[i] - 'a'];
        if (i && j && l1 != -1 && l2 != -1)
          d[i + 1][j + 1] =
              min(d[i + 1][j + 1],
                  d[l1][l2] + te + (i - l1 - 1) * td + (j - l2 - 1) * ti);
      }
    }
  printf("%d\n", d[n][m]);
  return 0;
}
