#include <bits/stdc++.h>
using namespace std;
int c_ins, c_del, c_rep, c_swp;
int H[4005][4005];
int dam_lav(string s, string t, int C) {
  int l1 = s.size(), l2 = t.size(),
      INF = s.size() * c_del + t.size() * c_ins + 1, DA[C];
  int i, j;
  H[0][0] = INF;
  for (i = 0; i <= l1; i++) {
    H[i + 1][1] = i * c_del;
    H[i + 1][0] = INF;
  }
  for (i = 0; i <= l2; i++) {
    H[1][i + 1] = i * c_ins;
    H[0][i + 1] = INF;
  }
  for (i = 0; i <= C; i++) DA[i] = 0;
  for (i = 1; i <= l1; i++) {
    int DB = 0;
    for (j = 1; j <= l2; j++) {
      int i1 = DA[t[j - 1] - 'a'];
      int j1 = DB;
      int d = ((s[i - 1] == t[j - 1]) ? 0 : c_rep);
      if (d == 0) DB = j;
      H[i + 1][j + 1] =
          min(H[i][j] + d,
              min(H[i + 1][j] + c_ins,
                  min(H[i][j + 1] + c_del, H[i1][j1] + (i - i1 - 1) * c_del +
                                               c_swp + (j - j1 - 1) * c_ins)));
    }
    DA[s[i - 1] - 'a'] = i;
  }
  return H[l1 + 1][l2 + 1];
}
int main() {
  string s, t;
  cin >> c_ins >> c_del >> c_rep >> c_swp;
  cin >> s >> t;
  cout << dam_lav(s, t, 30) << endl;
  ;
  return 0;
}
