#include <bits/stdc++.h>
using namespace std;
int dp[4005][4005];
char init[10000];
char target[10000];
int ninit, ntarget;
int pinsert, pdelete, preplace, pswap;
int initright[4005][40];
int targetright[4005][40];
int main() {
  scanf("%d%d%d%d\n", &pinsert, &pdelete, &preplace, &pswap);
  if (preplace > pinsert + pdelete) preplace = pinsert + pdelete;
  scanf("%s\n", init);
  scanf("%s\n", target);
  ninit = strlen(init);
  ntarget = strlen(target);
  for (int(i) = 0; (i) < (4005); ++(i))
    for (int(j) = 0; (j) < (4005); ++(j)) dp[i][j] = 1023123123;
  dp[0][0] = 0;
  for (int(i) = 0; (i) < (26); ++(i)) initright[ninit][i] = -1023123123;
  for (int i = ninit - 1; i >= 0; --i)
    for (int(j) = 0; (j) < (26); ++(j)) {
      if (i != ninit - 1 && init[i + 1] == 'a' + j) {
        initright[i][j] = i + 1;
      } else {
        initright[i][j] = initright[i + 1][j];
      }
    }
  for (int(i) = 0; (i) < (26); ++(i)) targetright[ntarget][i] = -1023123123;
  for (int i = ntarget - 1; i >= 0; --i)
    for (int(j) = 0; (j) < (26); ++(j)) {
      if (i != ntarget - 1 && target[i + 1] == 'a' + j) {
        targetright[i][j] = i + 1;
      } else {
        targetright[i][j] = targetright[i + 1][j];
      }
    }
  for (int(i) = 0; (i) < (ninit); ++(i))
    for (int(j) = 0; (j) < (ntarget); ++(j)) {
      if (target[j] == init[i]) {
        dp[i + 1][j + 1] = min((dp[i + 1][j + 1]), (dp[i][j]));
        continue;
      }
      if (initright[i][target[j] - 'a'] >= 0) {
        int loc = initright[i][target[j] - 'a'];
        if (j + 1 < ntarget) {
          dp[loc + 1][j + 2] =
              min((dp[loc + 1][j + 2]),
                  (dp[i][j] + (loc - i - 1) * pdelete + pswap + preplace));
        }
      }
      if (j + 1 < ntarget && target[j + 1] == init[i] && i + 1 < ninit) {
        dp[i + 2][j + 2] =
            min((dp[i + 2][j + 2]), (dp[i][j] + pswap + preplace));
      }
      if (initright[i][target[j] - 'a'] >= 0 &&
          targetright[j][init[i] - 'a'] >= 0) {
        int loc = initright[i][target[j] - 'a'];
        int fin = targetright[j][init[i] - 'a'];
        dp[loc + 1][fin + 1] =
            min((dp[loc + 1][fin + 1]), (dp[i][j] + (loc - i - 1) * pdelete +
                                         pswap + (fin - j - 1) * pinsert));
      }
      dp[i + 1][j + 1] = min((dp[i + 1][j + 1]), (dp[i][j] + preplace));
      dp[i][j + 1] = min((dp[i][j + 1]), (dp[i][j] + pinsert));
      dp[i + 1][j] = min((dp[i + 1][j]), (dp[i][j] + pdelete));
    }
  for (int(j) = 0; (j) < (ntarget); ++(j)) {
    dp[ninit][ntarget] =
        min((dp[ninit][ntarget]), (dp[ninit][j] + (ntarget - j) * pinsert));
  }
  int ret = 1023123123;
  for (int(i) = 0; (i) < (ninit + 1); ++(i)) {
    ret = min((ret), ((ninit - i) * pdelete + dp[i][ntarget]));
  }
  printf("%d\n", ret);
  return 0;
}
