#include <bits/stdc++.h>
using namespace std;
template <class T>
void PV(T &x) {
  for (__typeof__((x).begin()) i = (x).begin(); i != (x).end(); i++)
    cout << *i << " ";
  cout << endl;
}
template <class T>
void PA(T x[], int n) {
  for (int i = 0; i < n; i++) cout << x[i] << " ";
  cout << endl;
}
template <class T>
inline void gmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void gmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const int N = 4010, L = 26;
int ti, td, tr, te;
int s1[N], s2[N];
int n1, n2;
int f[N][N];
int pre1[N][L], pre2[N][L];
void work() {
  for (int i = 0; i < L; i++) pre1[0][i] = 0;
  for (int i = 1; i <= n1; i++) {
    for (int j = 0; j < L; j++) pre1[i][j] = pre1[i - 1][j];
    pre1[i][s1[i]] = i;
  }
  for (int i = 0; i < L; i++) pre2[0][i] = 0;
  for (int i = 1; i <= n2; i++) {
    for (int j = 0; j < L; j++) pre2[i][j] = pre2[i - 1][j];
    pre2[i][s2[i]] = i;
  }
  for (int i = 0; i <= n2; i++) f[0][i] = i * ti;
  for (int i = 0; i <= n1; i++) f[i][0] = i * td;
  for (int i = 1; i <= n1; i++) {
    for (int j = 1; j <= n2; j++) {
      int &ret = f[i][j];
      ret = f[i - 1][j - 1] + (s1[i] == s2[j] ? 0 : tr);
      gmin(ret, f[i - 1][j] + td);
      gmin(ret, f[i][j - 1] + ti);
      int t1 = pre1[i - 1][s2[j]];
      int t2 = pre2[j - 1][s1[i]];
      if (t1 > 0 && t2 > 0)
        gmin(ret, f[t1 - 1][t2 - 1] + te + td * (i - (t1 - 1) - 2) +
                      ti * (j - (t2 - 1) - 2));
    }
  }
  printf("%d\n", f[n1][n2]);
}
void myin() {
  char ts1[N], ts2[N];
  scanf("%d%d%d%d", &ti, &td, &tr, &te);
  scanf("%s%s", ts1 + 1, ts2 + 1);
  n1 = strlen(ts1 + 1);
  n2 = strlen(ts2 + 1);
  for (int i = 1; i <= n1; i++) s1[i] = ts1[i] - 'a';
  for (int i = 1; i <= n2; i++) s2[i] = ts2[i] - 'a';
}
int main() {
  myin();
  work();
  return 0;
}
