#include <bits/stdc++.h>
using namespace std;
int f[4001][4001], sa[4001][150], sb[4001][150], n, m, t1, t2, t3, t4, i, j;
string a, b;
int main() {
  cin >> t1 >> t2 >> t3 >> t4 >> a >> b;
  n = a.size(), m = b.size();
  a = " " + a;
  b = " " + b;
  for (i = 1; i <= n; i++) {
    f[i][0] = i * t2;
    for (j = 'a'; j <= 'z'; j++) sa[i][j] = sa[i - 1][j];
    sa[i][a[i]] = i;
  }
  for (i = 1; i <= m; i++) {
    f[0][i] = i * t1;
    for (j = 'a'; j <= 'z'; j++) sb[i][j] = sb[i - 1][j];
    sb[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]));
      int k = sa[i - 1][b[j]];
      int l = sb[j - 1][a[i]];
      if (k != 0 && l != 0)
        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;
}
