#include <bits/stdc++.h>
using namespace std;
string A, B;
int dp[4002][4002];
int prevA[4002][30];
int prevB[4002][30];
int ti, td, tr, te;
int main() {
  cin >> ti >> td >> tr >> te;
  cin >> A >> B;
  for (int i = 0; i < 26; i++) {
    prevA[0][i] = -1;
    prevB[0][i] = -1;
  }
  for (int i = 0; i < A.size(); i++) {
    for (int j = 0; j < 26; j++) {
      prevA[i + 1][j] = prevA[i][j];
    }
    prevA[i + 1][A[i] - 'a'] = i;
  }
  for (int i = 0; i < B.size(); i++) {
    for (int j = 0; j < 26; j++) {
      prevB[i + 1][j] = prevB[i][j];
    }
    prevB[i + 1][B[i] - 'a'] = i;
  }
  for (int i = 0; i <= A.size(); i++) {
    for (int j = 0; j <= B.size(); j++) {
      dp[i][j] = (int)1e9;
      if (i == 0) {
        dp[i][j] = j * ti;
      } else if (j == 0) {
        dp[i][j] = i * td;
      } else {
        dp[i][j] = min(dp[i][j], tr + dp[i - 1][j - 1]);
        if (A[i - 1] == B[j - 1]) {
          dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]);
        }
        dp[i][j] = min(dp[i][j], td + dp[i - 1][j]);
        dp[i][j] = min(dp[i][j], ti + dp[i][j - 1]);
        if (j != 1 && i != 1) {
          int indA = prevA[i - 1][B[j - 1] - 'a'];
          int indB = prevB[j - 1][A[i - 1] - 'a'];
          if (indA != -1 && indB != -1) {
            dp[i][j] = min(dp[i][j], dp[indA][indB] + te + td * (i - indA - 2) +
                                         ti * (j - indB - 2));
          }
        }
      }
    }
  }
  cout << dp[A.size()][B.size()];
}
