#include <bits/stdc++.h>
using namespace std;
int f[4001][4001], pa[4001][150], pb[4001][150], n, m, t1, t2, t3, t4, i, j, k,
    l;
char a[4001], b[4001];
int main() {
  cin >> t1 >> t2 >> t3 >> t4 >> a + 1 >> b + 1;
  n = strlen(a + 1), m = strlen(b + 1);
  for (i = 1; i <= n; i++) {
    f[i][0] = i * t2;
    for (j = 'a'; j <= 'z'; j++) pa[i][j] = pa[i - 1][j];
    pa[i][a[i]] = i;
  }
  for (i = 1; i <= m; i++) {
    f[0][i] = i * t1;
    for (j = 'a'; j <= 'z'; j++) pb[i][j] = pb[i - 1][j];
    pb[i][b[i]] = i;
  }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      f[i][j] = min(f[i][j - 1] + t1, f[i - 1][j] + t2);
      f[i][j] = min(f[i][j], f[i - 1][j - 1] + t3 * (a[i] != b[j]));
      if ((k = pa[i - 1][b[j]]) && (l = pb[j - 1][a[i]]))
        f[i][j] = min(f[i][j], f[k - 1][l - 1] + t4 + t2 * (i - k - 1) +
                                   t1 * (j - l - 1));
    }
  cout << f[n][m] << endl;
}
