#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4005;
int dp[MAXN][MAXN];
char a[MAXN], b[MAXN];
int nexta[MAXN][29], nextb[MAXN][29];
int n, m;
int main() {
  memset(dp, 20, sizeof(dp));
  int x, y, z, w;
  scanf("%d%d%d%d", &x, &y, &z, &w);
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  n = strlen(a + 1), m = strlen(b + 1);
  memset(nexta, -1, sizeof(nexta));
  memset(nextb, -1, sizeof(nextb));
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) nexta[i][j] = nexta[i + 1][j];
    nexta[i][a[i + 1] - 'a'] = i + 1;
  }
  for (int i = m - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) nextb[i][j] = nextb[i + 1][j];
    nextb[i][b[i + 1] - 'a'] = i + 1;
  }
  dp[0][0] = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + x);
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + y);
      if (a[i + 1] == b[j + 1])
        dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j]);
      else
        dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + z);
      if (i != n && j != m && nextb[j + 1][a[i + 1] - 'a'] != -1 &&
          nexta[i + 1][b[j + 1] - 'a'] != -1)
        dp[nexta[i + 1][b[j + 1] - 'a']][nextb[j + 1][a[i + 1] - 'a']] =
            min(dp[nexta[i + 1][b[j + 1] - 'a']][nextb[j + 1][a[i + 1] - 'a']],
                w + dp[i][j] + x * (nextb[j + 1][a[i + 1] - 'a'] - j - 2) +
                    y * (nexta[i + 1][b[j + 1] - 'a'] - i - 2));
    }
  printf("%d\n", dp[n][m]);
  return 0;
}
