#include <bits/stdc++.h>
using namespace std;
int ti, td, tr, te, n, m;
string A, B;
int p1[5000][28], p2[5000][28];
int dp[4050][4050];
int main() {
  ios_base::sync_with_stdio(0);
  int prev;
  cin >> ti >> td >> tr >> te;
  cin >> A >> B;
  n = A.size();
  m = B.size();
  for (int j = 0; j < 26; j++) {
    prev = -1;
    for (int i = 0; i < n; i++) {
      if (A[i] == j + 'a') prev = i;
      p1[i][j] = prev;
    }
  }
  for (int j = 0; j < 26; j++) {
    prev = -1;
    for (int i = 0; i < m; i++) {
      if (B[i] == j + 'a') prev = i;
      p2[i][j] = prev;
    }
  }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) dp[i][j] = 1e9;
  for (int i = 0; i <= n; i++) dp[i][0] = td * i;
  for (int i = 0; i <= m; i++) dp[0][i] = ti * i;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      dp[i][j] = min(dp[i][j], dp[i - 1][j] + td);
      dp[i][j] = min(dp[i][j], dp[i][j - 1] + ti);
      dp[i][j] =
          min(dp[i][j], dp[i - 1][j - 1] + (A[i - 1] == B[j - 1] ? 0 : tr));
      if (A[i - 1] != B[j - 1]) {
        int prev1 = p1[i - 1][B[j - 1] - 'a'];
        int prev2 = p2[j - 1][A[i - 1] - 'a'];
        if (prev1 > -1 && prev2 > -1) {
          dp[i][j] = min(dp[i][j], td * (i - prev1 - 2) + te +
                                       ti * (j - prev2 - 2) + dp[prev1][prev2]);
        }
      }
    }
  cout << dp[n][m] << endl;
  return 0;
}
