#include <bits/stdc++.h>
using namespace std;
const int N = 4010;
int f[N][N];
int pr[N][30], pr1[N][30];
char s[N], t[N];
int main() {
  int ti, td, tr, te;
  scanf("%d %d %d %d", &ti, &td, &tr, &te);
  scanf(" %s %s", s + 1, t + 1);
  int n1 = strlen(s + 1), n2 = strlen(t + 1);
  memset(f, 0x3f, sizeof f);
  f[0][0] = 0;
  for (int i = 0; i < n1; i++) {
    for (int j = 0; j < 26; j++) {
      pr[i + 1][j] = pr[i][j];
    }
    if (i > 0) pr[i + 1][s[i] - 'a'] = i;
  }
  for (int i = 0; i < n2; i++) {
    for (int j = 0; j < 26; j++) {
      pr1[i + 1][j] = pr1[i][j];
    }
    if (i > 0) pr1[i + 1][t[i] - 'a'] = i;
  }
  for (int i = 1; i <= n1; i++) f[i][0] = td * i;
  for (int i = 1; i <= n2; i++) f[0][i] = ti * i;
  for (int i = 1; i <= n1; i++) {
    for (int j = 1; j <= n2; j++) {
      if (s[i] == t[j])
        f[i][j] = min(f[i][j], f[i - 1][j - 1]);
      else
        f[i][j] = min(f[i][j], f[i - 1][j - 1] + min(tr, ti + td));
      f[i][j] = min(f[i][j], f[i - 1][j] + td);
      f[i][j] = min(f[i][j], f[i][j - 1] + ti);
      if (i >= 2 && j >= 2 && pr[i][t[j] - 'a'] > 0 && pr1[j][s[i] - 'a'] > 0) {
        f[i][j] =
            min(f[i][j], f[pr[i][t[j] - 'a'] - 1][pr1[j][s[i] - 'a'] - 1] + te +
                             (i - pr[i][t[j] - 'a'] - 1) * td +
                             (j - pr1[j][s[i] - 'a'] - 1) * ti);
      }
    }
  }
  cout << f[n1][n2] << endl;
  return 0;
}
