#include <bits/stdc++.h>
using namespace std;
int dp[5000][5000];
int main() {
  char a[5000], b[5000];
  int ti, td, tr, te;
  scanf("%d %d %d %d", &ti, &td, &tr, &te);
  scanf("%s %s", a, b);
  int n = strlen(a);
  int m = strlen(b);
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) dp[i][0] = dp[i - 1][0] + td;
  for (int i = 1; i <= m; i++) dp[0][i] = dp[0][i - 1] + ti;
  int da[26];
  int db;
  memset(da, 0, sizeof(da));
  int ii, jj, d;
  for (int i = 1; i <= n; i++) {
    db = 0;
    for (int j = 1; j <= m; j++) {
      d = (a[i - 1] == b[j - 1]) ? 0 : tr;
      ii = da[b[j - 1] - 'a'];
      jj = db;
      db = (a[i - 1] == b[j - 1]) ? j : db;
      dp[i][j] =
          min(dp[i][j - 1] + ti, min(dp[i - 1][j] + td, dp[i - 1][j - 1] + d));
      if (ii > 0 && jj > 0)
        dp[i][j] = min(dp[i][j], dp[ii - 1][jj - 1] + (i - ii - 1) * td +
                                     (j - jj - 1) * ti + te);
    }
    da[a[i - 1] - 'a'] = i;
  }
  printf("%d\n", dp[n][m]);
}
