#include <bits/stdc++.h>
using namespace std;
int cost[4001][4001], positionInSource[4001][123], positionInResult[4001][123];
int n, m;
int insertCost, deleteCost, replaceCost, swapCost;
char Source[4001], Result[4001];
int main() {
  cin >> insertCost >> deleteCost >> replaceCost >> swapCost;
  cin >> Source + 1;
  cin >> Result + 1;
  n = strlen(Source + 1);
  m = strlen(Result + 1);
  for (int i = 1; i <= n; i++) {
    cost[i][0] = i * deleteCost;
    for (int j = 'a'; j <= 'z'; j++)
      positionInSource[i][j] = positionInSource[i - 1][j];
    positionInSource[i][Source[i]] = i;
  }
  for (int i = 1; i <= m; i++) {
    cost[0][i] = i * insertCost;
    for (int j = 'a'; j <= 'z'; j++)
      positionInResult[i][j] = positionInResult[i - 1][j];
    positionInResult[i][Result[i]] = i;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cost[i][j] =
          min(cost[i][j - 1] + insertCost, cost[i - 1][j] + deleteCost);
      cost[i][j] = min(cost[i][j], cost[i - 1][j - 1] +
                                       replaceCost * (Source[i] != Result[j]));
      int k = positionInSource[i - 1][Result[j]];
      int l = positionInResult[j - 1][Source[i]];
      if ((k != 0) && (l != 0)) {
        cost[i][j] = min(cost[i][j], cost[k - 1][l - 1] + swapCost +
                                         deleteCost * (i - k - 1) +
                                         insertCost * (j - l - 1));
      }
    }
  cout << cost[n][m] << endl;
}
