#include <bits/stdc++.h>
using namespace std;
int DamerauLevenshteinDistance(const string &s, const string &t, int INS = 1,
                               int DEL = 1, int RPL = 1, int SWP = 1) {
  const int LMAX = 4000;
  static int dp[LMAX + 1][LMAX + 1];
  int slen = s.length(), tlen = t.length();
  for (int i = 0; i < slen + 1; i++) dp[i][0] = i * DEL;
  for (int j = 0; j < tlen + 1; j++) dp[0][j] = j * INS;
  int slast[128] = {};
  for (int i = 1; i <= slen; i++) {
    int tlast[128] = {};
    for (int j = 1; j <= tlen; j++) {
      int i1 = slast[t[j - 1]], j1 = tlast[s[i - 1]];
      dp[i][j] = min(min(dp[i - 1][j] + DEL, dp[i][j - 1] + INS),
                     dp[i - 1][j - 1] + (s[i - 1] == t[j - 1] ? 0 : RPL));
      if (i1 > 0 && j1 > 0) {
        dp[i][j] = min(dp[i][j], dp[i1 - 1][j1 - 1] + (i - i1 - 1) * DEL + SWP +
                                     (j - j1 - 1) * INS);
      }
      tlast[t[j - 1]] = j;
    }
    slast[s[i - 1]] = i;
  }
  return dp[slen][tlen];
}
int main() {
  int ti, td, tr, te;
  string s, t;
  cin >> ti >> td >> tr >> te >> s >> t;
  cout << DamerauLevenshteinDistance(s, t, ti, td, tr, te) << endl;
  return 0;
}
