#include <bits/stdc++.h>
using namespace std;
const int N = 4e3 + 10;
const int INF = 1 << 29;
int dp[N][N];
int A[N][26], B[N][26];
char s[N], t[N];
int main() {
  int ti, td, tr, te;
  scanf("%d%d%d%d", &ti, &td, &tr, &te);
  scanf("%s%s", s + 1, t + 1);
  int n = strlen(s + 1), m = strlen(t + 1);
  for (int k = 0; k < 26; ++k) {
    int prev = 0;
    for (int i = 1; i <= n; ++i) {
      if (s[i] == 'a' + k) prev = i;
      A[i][k] = prev;
    }
    prev = 0;
    for (int i = 1; i <= m; ++i) {
      if (t[i] == 'a' + k) prev = i;
      B[i][k] = prev;
    }
  }
  for (int i = 0; i <= n; ++i) dp[i][0] = td * i;
  for (int j = 0; j <= m; ++j) dp[0][j] = ti * j;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      dp[i][j] = INF;
      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] + (s[i] == t[j] ? 0 : tr));
      if (s[i] != t[j]) {
        int u = A[i][t[j] - 'a'];
        int v = B[j][s[i] - 'a'];
        if (u && v) {
          dp[i][j] = min(dp[i][j], (i - u - 1) * td + (j - v - 1) * ti + te +
                                       dp[u - 1][v - 1]);
        }
      }
    }
  }
  printf("%d\n", dp[n][m]);
  return 0;
}
