#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, p, ti, td, tr, te;
int dp[5050][5050], la[5005][27], lb[5005][27], pos[27];
char a[5050], b[5050];
int main() {
  memset(dp, 0x7f, sizeof(dp));
  memset(pos, 0, sizeof(pos));
  dp[0][0] = 0;
  scanf("%d%d%d%d", &ti, &td, &tr, &te);
  scanf("%s%s", a + 1, b + 1);
  n = strlen(a + 1);
  m = strlen(b + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 26; j++) la[i][j] = pos[j];
    pos[a[i] - 'a'] = i;
  }
  memset(pos, 0, sizeof(pos));
  for (int i = 1; i <= m; i++) {
    for (int j = 0; j < 26; j++) lb[i][j] = pos[j];
    pos[b[i] - 'a'] = i;
  }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      if (i > 0) dp[i][j] = min(dp[i][j], dp[i - 1][j] + td);
      if (j > 0) dp[i][j] = min(dp[i][j], dp[i][j - 1] + ti);
      if (i > 0 && j > 0)
        dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + (a[i] == b[j] ? 0 : tr));
      x = la[i][b[j] - 'a'];
      y = lb[j][a[i] - 'a'];
      if (x > 0 && y > 0) {
        p = (j - y - 1) * ti + (i - x - 1) * td + te;
        dp[i][j] = min(dp[i][j], dp[x - 1][y - 1] + p);
      }
    }
  printf("%d\n", dp[n][m]);
  return 0;
}
