#include <bits/stdc++.h>
using namespace std;
int pre1[4010][26], pre2[4010][26];
int f[4010][4010];
char s[4010], ss[4010];
int t[4];
int n, m;
void init() {
  scanf("%d%d%d%d", &t[0], &t[1], &t[2], &t[3]);
  scanf("%s", s);
  n = strlen(s);
  scanf("%s", ss);
  m = strlen(ss);
  for (int i = 0; i < 26; ++i) pre1[1][i] = pre2[1][i] = -1;
  for (int i = 2; i <= n; ++i) {
    for (int j = 0; j < 26; ++j) pre1[i][j] = pre1[i - 1][j];
    pre1[i][s[i - 2] - 'a'] = i - 1;
  }
  for (int i = 2; i <= m; ++i) {
    for (int j = 0; j < 26; ++j) pre2[i][j] = pre2[i - 1][j];
    pre2[i][ss[i - 2] - 'a'] = i - 1;
  }
}
void solve() {
  f[0][0] = 0;
  for (int i = 1; i <= m; ++i) f[0][i] = f[0][i - 1] + t[0];
  for (int i = 1; i <= n; ++i) f[i][0] = f[i - 1][0] + t[1];
  for (int i = 1; i <= n; ++i) {
    for (int p1, p2, j = 1; j <= m; ++j) {
      f[i][j] = 1000000000;
      f[i][j] = min(f[i][j - 1] + t[0], f[i][j]);
      f[i][j] = min(f[i - 1][j] + t[1], f[i][j]);
      f[i][j] = min(f[i - 1][j - 1] + t[2] * (s[i - 1] != ss[j - 1]), f[i][j]);
      if (1 < i && 1 < j) {
        p1 = pre1[i][ss[j - 1] - 'a'];
        p2 = pre2[j][s[i - 1] - 'a'];
        if (p1 > -1 && p2 > -1)
          f[i][j] = min(f[i][j], f[p1 - 1][p2 - 1] + t[1] * (i - p1 - 1) +
                                     t[0] * (j - p2 - 1) + t[3]);
      }
    }
  }
  printf("%d\n", f[n][m]);
}
int main() {
  init();
  solve();
  return 0;
}
