#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5000;
const int INF = 0x3f3f3f3f;
char A[MAXN], B[MAXN];
int dp[MAXN][MAXN];
int la[26], lb[26];
int main() {
  for (int ti, td, tr, te; cin >> ti >> td >> tr >> te;) {
    scanf("%s%s", A + 1, B + 1);
    int lenA = strlen(A + 1), lenB = strlen(B + 1);
    dp[0][0] = 0;
    for (int i = 1; i <= lenA; i++) {
      dp[i][0] = td * i;
    }
    for (int j = 1; j <= lenB; j++) {
      dp[0][j] = ti * j;
    }
    fill(la, la + 26, 0);
    for (int i = 1; i <= lenA; i++) {
      fill(lb, lb + 26, 0);
      for (int j = 1; j <= lenB; j++) {
        dp[i][j] = INF;
        dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + tr * (A[i] != B[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);
        int ii = la[B[j] - 'a'], jj = lb[A[i] - 'a'];
        if (ii > 0 && jj > 0) {
          dp[i][j] = min(dp[i][j], dp[ii - 1][jj - 1] + te + (i - ii - 1) * td +
                                       (j - jj - 1) * ti);
        }
        lb[B[j] - 'a'] = j;
      }
      la[A[i] - 'a'] = i;
    }
    printf("%d\n", dp[lenA][lenB]);
  }
  return 0;
}
